diff --git a/Makefile.am b/Makefile.am
index 99779260008d1099dbc0c90f860c5d6619da6320..d6e667ec139648703e3f41385202b943c3b66383 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -607,7 +607,7 @@ python_scripts = \
 dist_tools_SCRIPTS = \
 	$(python_scripts) \
 	tools/kvm-console-wrapper \
-	tools/xm-console-wrapper \
+	tools/xen-console-wrapper \
 	tools/master-ip-setup
 
 pkglib_python_scripts = \
diff --git a/htools/Ganeti/Confd/Server.hs b/htools/Ganeti/Confd/Server.hs
index f0ef0f290d34fe1280225dfc4eb6297653fe9668..14997625280ee8cc2ffd98f5375c5a7b4409d9bb 100644
--- a/htools/Ganeti/Confd/Server.hs
+++ b/htools/Ganeti/Confd/Server.hs
@@ -37,7 +37,6 @@ import Data.IORef
 import Data.List
 import qualified Data.Map as M
 import qualified Network.Socket as S
-import Prelude hiding (catch)
 import System.Posix.Files
 import System.Posix.Types
 import System.Time
@@ -307,7 +306,8 @@ updateConfig path r = do
 -- | Wrapper over 'updateConfig' that handles IO errors.
 safeUpdateConfig :: FilePath -> FStat -> CRef -> IO (FStat, ConfigReload)
 safeUpdateConfig path oldfstat cref = do
-  catch (do
+  Control.Exception.catch
+        (do
           nt <- needsReload oldfstat path
           case nt of
             Nothing -> return (oldfstat, ConfigToDate)
@@ -430,7 +430,8 @@ onReloadInner inotiaction path cref
 -- it will return False.
 addNotifier :: INotify -> FilePath -> CRef -> MVar ServerState -> IO Bool
 addNotifier inotify path cref mstate = do
-  catch (addWatch inotify [CloseWrite] path
+  Control.Exception.catch
+        (addWatch inotify [CloseWrite] path
                     (onInotify inotify path cref mstate) >> return True)
         (\e -> const (return False) (e::IOError))
 
diff --git a/htools/Ganeti/Daemon.hs b/htools/Ganeti/Daemon.hs
index c6708f13fe25b070d2491c2e17f8951658d1d74b..f9848234be45218a054fdafe9b047d161b086487 100644
--- a/htools/Ganeti/Daemon.hs
+++ b/htools/Ganeti/Daemon.hs
@@ -48,7 +48,6 @@ import qualified Data.Version
 import Data.Word
 import GHC.IO.Handle (hDuplicateTo)
 import qualified Network.Socket as Socket
-import Prelude hiding (catch)
 import System.Console.GetOpt
 import System.Exit
 import System.Environment
@@ -218,7 +217,8 @@ formatIOError msg err = msg ++ ": " ++  show err
 -- 'Bad' value.
 writePidFile :: FilePath -> IO (Result Fd)
 writePidFile path = do
-  catch (fmap Ok $ _writePidFile path)
+  Control.Exception.catch
+    (fmap Ok $ _writePidFile path)
     (return . Bad . formatIOError "Failure during writing of the pid file")
 
 -- | Sets up a daemon's environment.
@@ -282,8 +282,9 @@ parseAddress opts defport = do
   def_family <- Ssconf.getPrimaryIPFamily Nothing
   ainfo <- case optBindAddress opts of
              Nothing -> return (def_family >>= defaultBindAddr port)
-             Just saddr -> catch (resolveAddr port saddr)
-                           (annotateIOError $ "Invalid address " ++ saddr)
+             Just saddr -> Control.Exception.catch
+                             (resolveAddr port saddr)
+                             (annotateIOError $ "Invalid address " ++ saddr)
   return ainfo
 
 -- | Run an I/O action as a daemon.
diff --git a/htools/Ganeti/HTools/ExtLoader.hs b/htools/Ganeti/HTools/ExtLoader.hs
index bd258f5f3cb63104bf01874db4a9c0ae538796f8..69248d63996435c9aab551916bff3bc357f6a037 100644
--- a/htools/Ganeti/HTools/ExtLoader.hs
+++ b/htools/Ganeti/HTools/ExtLoader.hs
@@ -36,7 +36,6 @@ module Ganeti.HTools.ExtLoader
 import Control.Monad
 import Control.Exception
 import Data.Maybe (isJust, fromJust)
-import Prelude hiding (catch)
 import System.FilePath
 import System.IO
 import Text.Printf (hPrintf)
@@ -55,7 +54,8 @@ import Ganeti.HTools.Utils (sepSplit, tryRead, exitIfBad, exitWhen)
 
 -- | Error beautifier.
 wrapIO :: IO (Result a) -> IO (Result a)
-wrapIO = flip catch (\e -> return . Bad . show $ (e::IOException))
+wrapIO = flip Control.Exception.catch
+           (\e -> return . Bad . show $ (e::IOException))
 
 -- | Parses a user-supplied utilisation string.
 parseUtilisation :: String -> Result (String, DynUtil)
diff --git a/htools/Ganeti/HTools/QC.hs b/htools/Ganeti/HTools/QC.hs
index 5f7f51be0a85ecd931f133f95640a711ddb25757..2d25fad7cb47a864aad9be14c7a7efa0269bb858 100644
--- a/htools/Ganeti/HTools/QC.hs
+++ b/htools/Ganeti/HTools/QC.hs
@@ -1363,7 +1363,8 @@ prop_ClusterAllocBalance =
   forAll (choose (3, 5)) $ \count ->
   not (Node.offline node) && not (Node.failN1 node) ==>
   let nl = makeSmallCluster node count
-      (hnode, nl') = IntMap.deleteFindMax nl
+      hnode = snd $ IntMap.findMax nl
+      nl' = IntMap.deleteMax nl
       il = Container.empty
       allocnodes = Cluster.genAllocNodes defGroupList nl' 2 True
       i_templ = createInstance Types.unitMem Types.unitDsk Types.unitCpu
diff --git a/htools/Ganeti/HTools/Rapi.hs b/htools/Ganeti/HTools/Rapi.hs
index 10fbc6dded3a1d6763f60a065d9dc8dc85e8c6cc..11a78844b003d6f47ec01a3f19989dca60363662 100644
--- a/htools/Ganeti/HTools/Rapi.hs
+++ b/htools/Ganeti/HTools/Rapi.hs
@@ -38,7 +38,6 @@ import Network.Curl
 import Network.Curl.Types ()
 #endif
 import Control.Monad
-import Prelude hiding (catch)
 import Text.JSON (JSObject, fromJSObject, decodeStrict)
 import Text.JSON.Types (JSValue(..))
 import Text.Printf (printf)
@@ -85,8 +84,8 @@ getUrl url = do
 -- | Helper to convert I/O errors in 'Bad' values.
 ioErrToResult :: IO a -> IO (Result a)
 ioErrToResult ioaction =
-  catch (ioaction >>= return . Ok)
-        (\e -> return . Bad . show $ (e::IOException))
+  Control.Exception.catch (ioaction >>= return . Ok)
+    (\e -> return . Bad . show $ (e::IOException))
 
 -- | Append the default port if not passed in.
 formatHost :: String -> String
diff --git a/htools/Ganeti/Ssconf.hs b/htools/Ganeti/Ssconf.hs
index 39a3d95dfaac6badae2dfdb5148ee17bb731fc3c..e0020cc098894c8e0f99a0f1bce0944d19178912 100644
--- a/htools/Ganeti/Ssconf.hs
+++ b/htools/Ganeti/Ssconf.hs
@@ -40,7 +40,6 @@ import Control.Exception
 import Control.Monad (liftM)
 import Data.Char (isSpace)
 import Data.Maybe (fromMaybe)
-import Prelude hiding (catch)
 import qualified Network.Socket as Socket
 import System.FilePath ((</>))
 import System.IO.Error (isDoesNotExistError)
@@ -96,7 +95,8 @@ catchIOErrors :: Maybe a         -- ^ Optional default
               -> IO a            -- ^ Action to run
               -> IO (Result a)
 catchIOErrors def action =
-  catch (do
+  Control.Exception.catch
+        (do
           result <- action
           return (Ok result)
         ) (\err -> let bad_result = Bad (show err)
diff --git a/htools/htools.hs b/htools/htools.hs
index 2e847d7f2fc97655d349a78dfe950b8d237a200e..89081a70d9a7cde945f6f8892cf3d8d151a0ebd1 100644
--- a/htools/htools.hs
+++ b/htools/htools.hs
@@ -28,7 +28,6 @@ module Main (main) where
 import Control.Exception
 import Control.Monad (guard)
 import Data.Char (toLower)
-import Prelude hiding (catch)
 import System.Environment
 import System.Exit
 import System.IO
diff --git a/htools/test.hs b/htools/test.hs
index 6e434274bc11ab5b9af918395897fbba307400b4..25519543bfd173e7a11173ca67cf83e8a0fe33c6 100644
--- a/htools/test.hs
+++ b/htools/test.hs
@@ -102,9 +102,8 @@ runTests name opts tests max_count = do
                    printf "Test %s failed (seed was %s, test size %d): %s\n"
                           desc (show u) size o
                GaveUp { numTests = passed } ->
-                   printf "Test %s incomplete: gave up with only %d\
-                          \ passes after discarding %d tests\n"
-                          desc passed (maxDiscard opts)
+                   printf "Test %s incomplete: gave up with only %d passes\n"
+                          desc passed
                _ -> return ()
         ) results
   return results
@@ -149,7 +148,6 @@ transformTestOpts args opts = do
   return args { chatty = optVerbose opts > 1
               , replay = r
               , maxSuccess = fromMaybe (maxSuccess args) (optTestCount opts)
-              , maxDiscard = fromMaybe (maxDiscard args) (optTestCount opts)
               }
 
 main :: IO ()
diff --git a/lib/constants.py b/lib/constants.py
index e1e7057e4c4ef03d7703121103c2c8c79f36b50d..e168fd2307ff09a75ea185fb2d9589c0284ed2ab 100644
--- a/lib/constants.py
+++ b/lib/constants.py
@@ -163,7 +163,7 @@ DAEMON_UTIL = _autoconf.PKGLIBDIR + "/daemon-util"
 SETUP_SSH = _autoconf.TOOLSDIR + "/setup-ssh"
 KVM_IFUP = _autoconf.PKGLIBDIR + "/kvm-ifup"
 KVM_CONSOLE_WRAPPER = _autoconf.PKGLIBDIR + "/tools/kvm-console-wrapper"
-XM_CONSOLE_WRAPPER = _autoconf.PKGLIBDIR + "/tools/xm-console-wrapper"
+XEN_CONSOLE_WRAPPER = _autoconf.PKGLIBDIR + "/tools/xen-console-wrapper"
 ETC_HOSTS = "/etc/hosts"
 DEFAULT_FILE_STORAGE_DIR = _autoconf.FILE_STORAGE_DIR
 DEFAULT_SHARED_FILE_STORAGE_DIR = _autoconf.SHARED_FILE_STORAGE_DIR
diff --git a/lib/hypervisor/hv_xen.py b/lib/hypervisor/hv_xen.py
index 6e4e22410f1158aafa11d9597c48b6b1486de881..2b6132e68ec4168b0ea15c448572fe0e6e48fb8e 100644
--- a/lib/hypervisor/hv_xen.py
+++ b/lib/hypervisor/hv_xen.py
@@ -421,8 +421,8 @@ class XenHypervisor(hv_base.BaseHypervisor):
                                    kind=constants.CONS_SSH,
                                    host=instance.primary_node,
                                    user=constants.GANETI_RUNAS,
-                                   command=[constants.XM_CONSOLE_WRAPPER,
-                                            instance.name])
+                                   command=[constants.XEN_CONSOLE_WRAPPER,
+                                            constants.XEN_CMD, instance.name])
 
   def Verify(self):
     """Verify the hypervisor.
diff --git a/tools/xm-console-wrapper b/tools/xen-console-wrapper
similarity index 95%
rename from tools/xm-console-wrapper
rename to tools/xen-console-wrapper
index d6fd556637f4fa324009fd5349bc7885c411b146..f3d015a4a62f41d4d843f0a0ed3238581e2d836f 100755
--- a/tools/xm-console-wrapper
+++ b/tools/xen-console-wrapper
@@ -18,7 +18,8 @@
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 # 02110-1301, USA.
 
-INSTANCE="$1"
+XEN_CMD="$1"
+INSTANCE="$2"
 
 unpause() {
   ispaused=$(xm list -l "$INSTANCE" 2>/dev/null |
@@ -35,4 +36,4 @@ unpause() {
 }
 
 unpause &
-exec xm console "$INSTANCE"
+exec $XEN_CMD console "$INSTANCE"