diff --git a/Data/Bson.hs b/Data/Bson.hs
--- a/Data/Bson.hs
+++ b/Data/Bson.hs
@@ -7,7 +7,7 @@
 {-# LANGUAGE OverloadedStrings, TypeSynonymInstances, FlexibleInstances #-}
 {-# LANGUAGE DeriveDataTypeable, RankNTypes, OverlappingInstances #-}
 {-# LANGUAGE IncoherentInstances, ScopedTypeVariables #-}
-{-# LANGUAGE ForeignFunctionInterface, BangPatterns, CPP #-}
+{-# LANGUAGE ForeignFunctionInterface, BangPatterns #-}
 
 module Data.Bson (
 	-- * Document
@@ -22,10 +22,6 @@
 	Regex(..), Javascript(..), Symbol(..), MongoStamp(..), MinMaxKey(..),
 	-- ** ObjectId
 	ObjectId(..), timestamp, genObjectId
-#ifdef TEST
-    , composite
-    , roundTo
-#endif
 ) where
 
 import Prelude hiding (lookup)
diff --git a/Data/Bson/Binary.hs b/Data/Bson/Binary.hs
--- a/Data/Bson/Binary.hs
+++ b/Data/Bson/Binary.hs
@@ -13,7 +13,7 @@
 import Control.Monad (when)
 import Data.Binary.Get (Get, runGet, getWord8, getWord32be, getWord64be,
                         getWord32le, getWord64le, getLazyByteStringNul,
-                        getLazyByteString, getByteString, isEmpty)
+                        getLazyByteString, getByteString, lookAhead)
 import Data.Binary.Put (Put, runPut, putWord8, putWord32le, putWord64le,
                         putWord32be, putWord64be, putLazyByteString,
                         putByteString)
@@ -44,7 +44,7 @@
 	Array x -> putTL 0x04 >> putArray x
 	Bin (Binary x) -> putTL 0x05 >> putBinary 0x00 x
 	Fun (Function x) -> putTL 0x05 >> putBinary 0x01 x
-	Uuid (UUID x) -> putTL 0x05 >> putBinary 0x03 x
+	Uuid (UUID x) -> putTL 0x05 >> putBinary 0x04 x
 	Md5 (MD5 x) -> putTL 0x05 >> putBinary 0x05 x
 	UserDef (UserDefined x) -> putTL 0x05 >> putBinary 0x80 x
 	ObjId x -> putTL 0x07 >> putObjectId x
@@ -79,6 +79,7 @@
 			0x00 -> return $ Bin (Binary b)
 			0x01 -> return $ Fun (Function b)
 			0x03 -> return $ Uuid (UUID b)
+			0x04 -> return $ Uuid (UUID b)
 			0x05 -> return $ Md5 (MD5 b)
 			0x80 -> return $ UserDef (UserDefined b)
 			_ -> fail $ "unknown Bson binary subtype " ++ show s
@@ -148,12 +149,11 @@
 
 getDocument :: Get Document
 getDocument = do
-	len <- subtract 5 <$> getInt32
+	len <- subtract 4 <$> getInt32
 	b <- getLazyByteString (fromIntegral len)
-	getWord8
 	return (runGet getFields b)
  where
-	getFields = isEmpty >>= \done -> if done
+	getFields = lookAhead getWord8 >>= \done -> if done == 0
 		then return []
 		else (:) <$> getField <*> getFields
 
diff --git a/bson.cabal b/bson.cabal
--- a/bson.cabal
+++ b/bson.cabal
@@ -1,5 +1,5 @@
 Name:          bson
-Version:       0.2.1
+Version:       0.2.2
 Synopsis:      BSON documents are JSON-like objects with a standard binary
                encoding.
 Description:   A BSON Document is an untyped (dynamically type-checked) record.
