     @keys.splice(index, 0, key)
     
     @emit "set", key, value
-    cb(null, value)
+    
+    cb(null, value) if cb
+    value
     
   del: (key, cb) ->
     delete @items[key]
     
-    if (index = self.keys.indexOf(key)) > 0
+    if (index = @keys.indexOf(key)) > 0
       @keys.splice(index, 1)
-      
-    @emit "del", key
-    cb(null)
+      @emit "del", key
     
-  _sleep: -> JSON.stringify({@keys, @items})
-  _wakeup: (data) -> {@keys, @items} = JSON.parse(data)
+    cb(null) if cb
+    return
+    
+  _sleep: -> JSON.stringify(@items)
+  _wakeup: (data) -> @set(key, value) for key, value of JSON.parse(data)
   
-  _save: =>
+  _save: (cb) =>
     self = @
     
     console.info "[INFO] Writing backup to: #{@options.filename}"

    @_save = _.throttle(@_save, 1000 * 60) # Max once a minute
    
    if @options.filename
      @_restore()
      @on "set", @_save
      @on "del", @_save
  
  at: (index, cb) -> @get(@keys[index], cb)
  list: (start, end, cb) ->
    self = @
    cb null, _.map @keys.slice(start, end), (key, value) -> [key, clone(self.items[key])]
  
  get: (key, cb) ->
    value = clone(@items[key])
    @emit "get", key, value
    cb(null, value)
    
  set: (key, value, cb) ->
    index =
      if @options.comparator then _.sortedIndex(@items, value, @options.comparator)
      else @items.length

        catch e
          return console.error "[ERR] Restore failed to parse from: #{self.options.filename}"

        console.log "[OK] Restore succeeded from: #{self.options.filename}"
      
      cb() if cb