diff --git a/Storage/Hashed/Index.hs b/Storage/Hashed/Index.hs
--- a/Storage/Hashed/Index.hs
+++ b/Storage/Hashed/Index.hs
@@ -261,9 +261,7 @@
            subs off | off < following = do
              result <- readItem index $ substate { start = off }
              rest <- subs $ next result
-             case treeitem result of
-               Nothing -> return $! rest
-               Just _  -> return $! (name (resitem result) $ dirlength substate, result) : rest
+             return $! (name (resitem result) $ dirlength substate, result) : rest
            subs coff | coff == following = return []
                      | otherwise = fail $ "Offset mismatch at " ++ show coff ++
                                           " (ends at " ++ show following ++ ")"
@@ -271,8 +269,9 @@
        inferiors <- if want then subs $ start substate
                             else return []
 
-       let we_changed = or [ changed x | (_, x) <- inferiors ] || leaf
-           leaf = null inferiors
+       let we_changed = or [ changed x | (_, x) <- inferiors ] || nullleaf
+           nullleaf = null inferiors && oldhash == nullsha
+           nullsha = SHA256 (BS.replicate 32 0)
            tree' = makeTree [ (n, fromJust $ treeitem s) | (n, s) <- inferiors, isJust $ treeitem s ]
            treehash = we_changed ? (hashtree index tree', oldhash)
            tree = tree' { treeHash = treehash }
diff --git a/hashed-storage.cabal b/hashed-storage.cabal
--- a/hashed-storage.cabal
+++ b/hashed-storage.cabal
@@ -1,5 +1,5 @@
 name:          hashed-storage
-version:       0.4.9
+version:       0.4.10
 synopsis:      Hashed file storage support code.
 
 description:   Support code for reading and manipulating hashed file storage
