diff --git a/BTree/BuildUnordered.hs b/BTree/BuildUnordered.hs
--- a/BTree/BuildUnordered.hs
+++ b/BTree/BuildUnordered.hs
@@ -56,7 +56,7 @@
     fillLists prod = do
       fname <- liftIO $ tempFilePath scratch "chunk.list"
       (leaves, rest) <- lift $ takeChunk maxChunk prod
-      (bList, ()) <- lift $ BL.toBinaryList fname $ each leaves
+      (bList, ()) <- lift $ BL.toBinaryList fname $ each $ S.toAscList leaves
       modify (bList:)
       case rest of
         Left r         -> return r
diff --git a/b-tree.cabal b/b-tree.cabal
--- a/b-tree.cabal
+++ b/b-tree.cabal
@@ -1,5 +1,5 @@
 name:                b-tree
-version:             0.1.0.0
+version:             0.1.1
 synopsis:            Immutable disk-based B* trees
 description:         Immutable disk-based B* trees
 homepage:            http://github.com/bgamari/b-tree
@@ -43,7 +43,7 @@
                        bytestring >=0.10 && <0.11,
                        binary >=0.7 && <0.8,
                        transformers >=0.3 && <0.5,
-                       lens >=3.10 && <4.3,
+                       lens >=3.10 && <4.8,
                        containers >=0.5 && <0.6,
                        vector >=0.10 && <0.11,
                        errors >=1.4 && <1.5,
@@ -52,6 +52,17 @@
                        mmap >=0.5 && <0.6
   default-language:    Haskell2010
   ghc-options:         -Wall
+
+test-suite btree-quickcheck
+  type:                exitcode-stdio-1.0
+  main-is:             QuickCheck.hs
+  hs-source-dirs:      tests
+  build-depends:       base >=4.6 && <4.8,
+                       containers,
+                       pipes,
+                       binary,
+                       b-tree,
+                       QuickCheck
 
 benchmark btree-benchmark
   type:                exitcode-stdio-1.0
diff --git a/tests/QuickCheck.hs b/tests/QuickCheck.hs
new file mode 100644
--- /dev/null
+++ b/tests/QuickCheck.hs
@@ -0,0 +1,25 @@
+import Test.QuickCheck
+import qualified Data.Map as M
+import Data.Foldable (foldl')
+import Data.Binary (Binary)
+import Pipes hiding (discard)
+import qualified BTree as BT
+
+instance (Ord k, Arbitrary k, Arbitrary v) => Arbitrary (M.Map k v) where
+    arbitrary = do
+        ks <- arbitrary
+        vs <- arbitrary
+        return $ foldl' (\m (k,v)->M.insert k v m) M.empty (zip ks vs)
+
+mapToBLeafs :: M.Map k v -> [BT.BLeaf k v]
+mapToBLeafs = map (\(k,v)->BT.BLeaf k v) . M.toAscList
+
+test :: (Ord k, Eq v, Binary k, Binary v) => M.Map k v -> Property
+test m | M.size m == 0 = discard
+test m = ioProperty $ do
+    let len = fromIntegral $ M.size m
+    bs <- BT.fromOrderedToByteString 10 len (each $ mapToBLeafs m)
+    let Right bt = BT.fromByteString bs
+    return $ all (\(k,v)->BT.lookup bt k == Just v) (M.assocs m)
+
+main = quickCheck (test :: M.Map Int Int -> Property)
