   # Returns promise for a set member
   srandmember: (key) ->
     key = @key key
-    Q @data._private[key][_.random 0, @data._private[key].length - 1]
+    Q @data._private[key]?[_.random 0, @data._private[key]?.length - 1]
 
   # Public: Get all the members of the set
   #

  #
  # Returns: promise for the value.
  hget: (table, key) ->
    Q(@deserialize @data._private[@key table][key])

  # Public: Delete a field from a hash table
  #
  # Returns promise
  hdel: (table, key) ->
    delete @data._private[@key table][key]
    Q @

  # Public: Get the whole hash table as an object.

  #
  # Returns int
  llen: (key) ->
    Q(@data._private[@key key]?.length)

  # Public: set the list value at the specified index
  #
  # Returns promise
  lset: (key, index, value) ->
    key = @key key

    if not @data._private[key]
      @data._private[key] = []

    @data._private[@key key][index] = @serialize value
    Q @

