diff --git a/Data/BinaryList.hs b/Data/BinaryList.hs
--- a/Data/BinaryList.hs
+++ b/Data/BinaryList.hs
@@ -264,6 +264,7 @@
 fromListBuilderWithDefault e = go
   where
     go [] _ n = replicate n e
+    go xs _ 0 = ListEnd $ Prelude.head xs -- Hopefully we can avoid this case?
     go xs l n =
       let m = n - 1
           l' = 2^m
diff --git a/Data/BinaryList/Serialize.hs b/Data/BinaryList/Serialize.hs
--- a/Data/BinaryList/Serialize.hs
+++ b/Data/BinaryList/Serialize.hs
@@ -19,6 +19,7 @@
    , encodedFromByteString
    ) where
 
+import Prelude hiding (reverse)
 -- Binary lists
 import Data.BinaryList.Internal
 import Data.BinaryList
@@ -71,8 +72,8 @@
 encodeBinList :: (a -> Put) -> Direction -> BinList a -> EncodedBinList
 encodeBinList f d xs = EncodedBinList d (lengthIndex xs) $
   if d == FromLeft
-     then runPut $ foldl (\y x -> y >> f x) (return ()) $ toList xs
-     else runPut $ foldr (\x y -> f x >> y) (return ()) $ toList xs
+     then runPut $ foldr (\x y -> f x >> y) (return ()) $ toList xs
+     else runPut $ foldl (\y x -> f x >> y) (return ()) $ toList xs
 
 -- | A binary list decoded, from where you can extract a binary list. If the
 --   decoding process fails in some point, you still will be able to retrieve
@@ -118,6 +119,19 @@
     Left (r,_,err) -> DecodingError err r
     Right (r,_,x) -> go r (ListEnd x)
   where
+    -- | To avoid looking at the direction in each recursive step,
+    --   we provide a function to append newly read data with the
+    --   accumulated binary list depending on the direction. Since the
+    --   new data is of the same size as the accumulated binary list,
+    --   we can append them safely just by using 'ListNode'.
+    --
+    -- recAppend :: Int -> BinList a -> BinList a -> BinList a
+    recAppend i = case d of
+       FromLeft    -> ListNode (i+1)
+       _ -> \xs ys -> ListNode (i+1) (reverse ys) xs
+
+    -- | Recursive decoding function.
+    --
     -- go :: ByteString -- ^ Input data.
     --    -> BinList a -- ^ Accumulated binary list.
     --    -> Decoded a
@@ -130,20 +144,15 @@
               -- the already decoded data, prepending the accumulated data as
               -- a partial result.
               else PartialResult xs $ case runGetOrFail (replicateM (2^i) f) input of
-                     -- In case of error, we return the accumulated result
-                     -- followed by a decoding error.
+                     -- In case of error, we return a decoding error.
                      Left (r,_,err) -> DecodingError err r
                      Right (r,_,list) ->
-                       let -- Binary list of new data
+                       let -- Otherwise, we build a new binary list with the collected
+                           -- new data.
                            ys = fromListBuilder list i
-                           -- Since the new data is of the same size of the accumulated
-                           -- binary list, we can append safely just using 'ListNode'.
-                           -- The appending order is determined by the encoding direction.
-                           zs = if d == FromLeft
-                                   then ListNode (i+1) xs ys
-                                   else ListNode (i+1) ys xs
-                           -- The new list is fed to the next recursion step.
-                       in  go r zs
+                           -- The new list is appended with the accumulated list and fed
+                           -- to the next recursion step.
+                       in  go r $ recAppend i xs ys
 
 -- | Translate an encoded binary list to a bytestring.
 encodedToByteString :: EncodedBinList -> ByteString
diff --git a/binary-list.cabal b/binary-list.cabal
--- a/binary-list.cabal
+++ b/binary-list.cabal
@@ -1,5 +1,5 @@
 name:                binary-list
-version:             0.2.0.3
+version:             0.2.0.4
 synopsis:            Lists of size length a power of two.
 description:         Some algorithmic problems work only when the input list
                      has length a power of two. This library provides with a
