diff --git a/hedis.cabal b/hedis.cabal
--- a/hedis.cabal
+++ b/hedis.cabal
@@ -1,5 +1,5 @@
 name:               hedis
-version:            0.3.2
+version:            0.4
 synopsis:
     Client library for the Redis datastore: supports full command set,  
     pipelining.
@@ -33,6 +33,16 @@
         TCP connection.
     .
     For detailed documentation, see the "Database.Redis" module.
+    .
+    [Changes since version 0.3.2]
+    .
+    * Some commands got a 'Maybe' added to their return type, to properly handle
+        Redis returning @nil@-replies.
+    .
+    * Updated dependencies on @bytestring-lexing@ and @stm@.
+    .
+    * Minor improvements and fixes to the documentation.
+    .
 license:            BSD3
 license-file:       LICENSE
 author:             Falko Peters
@@ -67,11 +77,11 @@
   build-depends:    attoparsec == 0.10.*,
                     base == 4.*,
                     bytestring == 0.9.*,
-                    bytestring-lexing == 0.3.*,
+                    bytestring-lexing == 0.4.*,
                     mtl == 2.*,
                     network == 2.*,
                     resource-pool == 0.2.1.*,
-                    stm == 2.2.*,
+                    stm == 2.3.*,
                     time
 
   other-modules:    Database.Redis.Core,
diff --git a/src/Database/Redis.hs b/src/Database/Redis.hs
--- a/src/Database/Redis.hs
+++ b/src/Database/Redis.hs
@@ -72,7 +72,7 @@
     -- @
     -- -- |Redis DEBUG OBJECT command
     -- debugObject :: ByteString -> 'Redis' (Either 'Reply' ByteString)
-    -- debugObject key = 'sendRequest' [\"DEBUG\", \"OBJECT\", 'encode' key]
+    -- debugObject key = 'sendRequest' [\"DEBUG\", \"OBJECT\", key]
     -- @
     --
     Reply(..),Status(..),RedisResult(..),ConnectionLostException(..),
diff --git a/src/Database/Redis/Commands.hs b/src/Database/Redis/Commands.hs
--- a/src/Database/Redis/Commands.hs
+++ b/src/Database/Redis/Commands.hs
@@ -157,7 +157,7 @@
 exec, -- |Execute all commands issued after MULTI (<http://redis.io/commands/exec>).
 multi, -- |Mark the start of a transaction block (<http://redis.io/commands/multi>).
 unwatch, -- |Forget about all watched keys (<http://redis.io/commands/unwatch>).
-watch, -- |Watch the given keys to determine execution of the MULTI/EXEC block (<http://redis.io/commands/watch>).
+watch, -- |Watch the given keys to determine execution of the MULTI\/EXEC block (<http://redis.io/commands/watch>).
 
 -- * Unimplemented Commands
 -- |These commands are not implemented, as of now. Library
@@ -211,14 +211,14 @@
 zrevrank
     :: ByteString -- ^ key
     -> ByteString -- ^ member
-    -> Redis (Either Reply Integer)
+    -> Redis (Either Reply (Maybe Integer))
 zrevrank key member = sendRequest (["ZREVRANK"] ++ [encode key] ++ [encode member] )
 
 brpoplpush
     :: ByteString -- ^ source
     -> ByteString -- ^ destination
     -> Integer -- ^ timeout
-    -> Redis (Either Reply ByteString)
+    -> Redis (Either Reply (Maybe ByteString))
 brpoplpush source destination timeout = sendRequest (["BRPOPLPUSH"] ++ [encode source] ++ [encode destination] ++ [encode timeout] )
 
 incrby
@@ -229,7 +229,7 @@
 
 rpop
     :: ByteString -- ^ key
-    -> Redis (Either Reply ByteString)
+    -> Redis (Either Reply (Maybe ByteString))
 rpop key = sendRequest (["RPOP"] ++ [encode key] )
 
 setrange
@@ -358,7 +358,7 @@
 rpoplpush
     :: ByteString -- ^ source
     -> ByteString -- ^ destination
-    -> Redis (Either Reply ByteString)
+    -> Redis (Either Reply (Maybe ByteString))
 rpoplpush source destination = sendRequest (["RPOPLPUSH"] ++ [encode source] ++ [encode destination] )
 
 hlen
@@ -396,7 +396,7 @@
 
 lpop
     :: ByteString -- ^ key
-    -> Redis (Either Reply ByteString)
+    -> Redis (Either Reply (Maybe ByteString))
 lpop key = sendRequest (["LPOP"] ++ [encode key] )
 
 hmget
@@ -489,7 +489,7 @@
 zrank
     :: ByteString -- ^ key
     -> ByteString -- ^ member
-    -> Redis (Either Reply Integer)
+    -> Redis (Either Reply (Maybe Integer))
 zrank key member = sendRequest (["ZRANK"] ++ [encode key] ++ [encode member] )
 
 zremrangebyscore
@@ -516,12 +516,12 @@
 rpush key value = sendRequest (["RPUSH"] ++ [encode key] ++ map encode value )
 
 randomkey
-    :: Redis (Either Reply ByteString)
+    :: Redis (Either Reply (Maybe ByteString))
 randomkey  = sendRequest (["RANDOMKEY"] )
 
 spop
     :: ByteString -- ^ key
-    -> Redis (Either Reply ByteString)
+    -> Redis (Either Reply (Maybe ByteString))
 spop key = sendRequest (["SPOP"] ++ [encode key] )
 
 hsetnx
@@ -712,13 +712,13 @@
 lindex
     :: ByteString -- ^ key
     -> Integer -- ^ index
-    -> Redis (Either Reply ByteString)
+    -> Redis (Either Reply (Maybe ByteString))
 lindex key index = sendRequest (["LINDEX"] ++ [encode key] ++ [encode index] )
 
 zscore
     :: ByteString -- ^ key
     -> ByteString -- ^ member
-    -> Redis (Either Reply Double)
+    -> Redis (Either Reply (Maybe Double))
 zscore key member = sendRequest (["ZSCORE"] ++ [encode key] ++ [encode member] )
 
 strlen
@@ -753,7 +753,7 @@
 
 srandmember
     :: ByteString -- ^ key
-    -> Redis (Either Reply ByteString)
+    -> Redis (Either Reply (Maybe ByteString))
 srandmember key = sendRequest (["SRANDMEMBER"] ++ [encode key] )
 
 persist
diff --git a/src/Database/Redis/ManualCommands.hs b/src/Database/Redis/ManualCommands.hs
--- a/src/Database/Redis/ManualCommands.hs
+++ b/src/Database/Redis/ManualCommands.hs
@@ -21,7 +21,7 @@
 
 objectEncoding
     :: ByteString -- ^ key
-    -> Redis (Either Reply ByteString)
+    -> Redis (Either Reply (Maybe ByteString))
 objectEncoding key = sendRequest ["OBJECT", "encoding", encode key]
 
 linsertBefore
@@ -167,6 +167,7 @@
     sendRequest ["ZREVRANGEBYSCORE", encode key, encode min, encode max
                 ,"WITHSCORES","LIMIT", encode offset, encode count]
 
+-- |Options for the 'sort' command.
 data SortOpts = SortOpts
     { sortBy     :: Maybe ByteString
     , sortLimit  :: (Integer,Integer)
@@ -175,6 +176,18 @@
     , sortAlpha  :: Bool
     } deriving (Show, Eq)
 
+-- |Redis default 'SortOpts'. Equivalent to omitting all optional parameters.
+--
+-- @
+-- SortOpts
+--     { sortBy    = Nothing -- omit the BY option
+--     , sortLimit = (0,-1)  -- return entire collection
+--     , sortGet   = []      -- omit the GET option
+--     , sortOrder = Asc     -- sort in ascending order
+--     , sortAlpha = False   -- sort numerically, not lexicographically
+--     }
+-- @
+--
 defaultSortOpts :: SortOpts
 defaultSortOpts = SortOpts
     { sortBy    = Nothing
diff --git a/test/Test.hs b/test/Test.hs
--- a/test/Test.hs
+++ b/test/Test.hs
@@ -158,7 +158,7 @@
 testRandomkey = testCase "randomkey" $ do
     set "k1" "value" >>=? Ok
     set "k2" "value" >>=? Ok
-    Right k <- randomkey
+    Right (Just k) <- randomkey
     assert $ k `elem` ["k1", "k2"]
 
 testRename :: Test
@@ -190,8 +190,8 @@
     let opts = defaultSortOpts { sortOrder = Desc, sortAlpha = True
                                , sortLimit = (1,2)
                                , sortBy    = Just "weight_*"
-                               , sortGet   = ["object_*"] }
-    sort "ids" opts >>=? ["bar","foo"]
+                               , sortGet   = ["#", "object_*"] }
+    sort "ids" opts >>=? ["2", "bar", "1", "foo"]
     
     
 testTtl :: Test
@@ -414,18 +414,21 @@
 
 testBrpoplpush :: Test
 testBrpoplpush = testCase "brpoplpush/rpoplpush" $ do
-    rpush "k1" ["v1","v2"] >>=? 2
-    brpoplpush "k1" "k2" 1 >>=? "v2"
-    rpoplpush "k1" "k2"    >>=? "v1"
-    llen "k2"              >>=? 2
-    llen "k1"              >>=? 0
+    rpush "k1" ["v1","v2"]      >>=? 2
+    brpoplpush "k1" "k2" 1      >>=? Just "v2"
+    rpoplpush "k1" "k2"         >>=? Just "v1"
+    rpoplpush "notAKey" "k2"    >>=? Nothing
+    llen "k2"                   >>=? 2
+    llen "k1"                   >>=? 0
+    -- run into timeout
+    brpoplpush "notAKey" "k2" 1 >>=? Nothing
 
 testLpop :: Test
 testLpop = testCase "lpop/rpop" $ do
     lpush "key" ["v3","v2","v1"] >>=? 3
-    lpop "key"                   >>=? "v1"
+    lpop "key"                   >>=? Just "v1"
     llen "key"                   >>=? 2
-    rpop "key"                   >>=? "v3"
+    rpop "key"                   >>=? Just "v3"
 
 testLinsert :: Test
 testLinsert = testCase "linsert" $ do
@@ -434,8 +437,8 @@
     linsertBefore "key" "notAVal" "v3" >>=? (-1)
     linsertAfter "key" "v2" "v3"       >>=? 3    
     linsertAfter "key" "notAVal" "v3"  >>=? (-1)
-    lindex "key" 0                     >>=? "v1"
-    lindex "key" 2                     >>=? "v3"
+    lindex "key" 0                     >>=? Just "v1"
+    lindex "key" 2                     >>=? Just "v3"
 
 testLpushx :: Test
 testLpushx = testCase "lpushx/rpushx" $ do
@@ -466,7 +469,7 @@
 testZAdd :: Test
 testZAdd = testCase "zadd/zrem/zcard/zscore/zincrby" $ do
     zadd "key" [(1,"v1"),(2,"v2"),(40,"v3")] >>=? 3
-    zscore "key" "v3"                        >>=? 40
+    zscore "key" "v3"                        >>=? Just 40
     zincrby "key" 2 "v3"                     >>=? 42
     zrem "key" ["v3","notAKey"]              >>=? 1
     zcard "key"                              >>=? 2
@@ -474,8 +477,9 @@
 testZRank :: Test
 testZRank = testCase "zrank/zrevrank/zcount" $ do
     zadd "key" [(1,"v1"),(2,"v2"),(40,"v3")] >>=? 3
-    zrank "key" "v1"                         >>=? 0
-    zrevrank "key" "v1"                      >>=? 2
+    zrank "notAKey" "v1"                     >>=? Nothing
+    zrank "key" "v1"                         >>=? Just 0
+    zrevrank "key" "v1"                      >>=? Just 2
     zcount "key" 10 100                      >>=? 1
 
 testZRemRange :: Test
