diff --git a/Ganeti/HTools/Container.hs b/Ganeti/HTools/Container.hs
index 937676ca9159ee4d56c559d33289e30e95e2d27e..9d8e56cc98824742b97cf0575f3ea8e63088fdf7 100644
--- a/Ganeti/HTools/Container.hs
+++ b/Ganeti/HTools/Container.hs
@@ -105,14 +105,10 @@ maxNameLen = maximum . map (length . T.nameOf) . elems
 
 -- | Find an element by name in a Container; this is a very slow function.
 findByName :: (T.Element a, Monad m) =>
-              Container a -> String -> m Key
+              Container a -> String -> m a
 findByName c n =
     let all_elems = elems c
         result = filter ((== n) . T.nameOf) all_elems
-        nems = length result
-    in
-      if nems /= 1 then
-          fail $ "Wrong number of elems (" ++ show nems ++
-                   ") found with name " ++ n
-      else
-          return $ T.idxOf $ head result
+    in case result of
+         [item] -> return item
+         _ -> fail $ "Wrong number of elems found with name " ++ n
diff --git a/Ganeti/HTools/IAlloc.hs b/Ganeti/HTools/IAlloc.hs
index af177f74b86c56de3ae246efe02afbfc18136231..2aef97c86cc9ca230ae90c51a197ce44c07cf695 100644
--- a/Ganeti/HTools/IAlloc.hs
+++ b/Ganeti/HTools/IAlloc.hs
@@ -126,7 +126,7 @@ parseData body = do
               ex_nodes <- fromObj "relocate_from" request
               let ex_nodes' = map (stripSuffix $ length csf) ex_nodes
               ex_idex <- mapM (Container.findByName map_n) ex_nodes'
-              return $ Relocate ridx req_nodes ex_idex
+              return $ Relocate ridx req_nodes (map Node.idx ex_idex)
         other -> fail ("Invalid request type '" ++ other ++ "'")
   return $ Request rqtype map_n map_i csf
 
diff --git a/Ganeti/HTools/Loader.hs b/Ganeti/HTools/Loader.hs
index 87f11f092a729f70b67241cdcda9cc8a5c991258..2873688debee8199d97f56e09cc3124d929ff8d6 100644
--- a/Ganeti/HTools/Loader.hs
+++ b/Ganeti/HTools/Loader.hs
@@ -139,10 +139,9 @@ mergeData :: [(String, DynUtil)]  -- ^ Instance utilisation data
 mergeData um (nl, il) = do
   let il2 = Container.fromAssocList il
   il3 <- foldM (\im (name, n_util) -> do
-                  idx <- Container.findByName im name
-                  let inst = Container.find idx im
-                      new_i = inst { Instance.util = n_util }
-                  return $ Container.add idx new_i im
+                  inst <- Container.findByName im name
+                  let new_i = inst { Instance.util = n_util }
+                  return $ Container.add (Instance.idx inst) new_i im
                ) il2 um
   let nl2 = foldl' fixNodes nl (Container.elems il3)
   let nl3 = Container.fromAssocList