       @_cache = @allSync()
 
   _getFileName: (id) ->
-    if @_single then "#{@_dir}/#{path.basename @name}.json"
+    if @_single then path.join @_dir, (path.basename @name) + ".json"
     else id2fileName id, @_dir
 
   save: (id, o, cb=->) -> save.call @, id, o, cb

    if @_memory then done()
    else
      if cb?
        saveObjectToFile @_cache, file, done
      else
        err = (o = saveObjectToFile @_cache, file) instanceof Error
        done err, o
  else
    done = (err) =>

    json = JSON.stringify o, null, indent
  catch e
    return if cb? then cb e else e
  tmpFileName = "#{@_getFileName uuid.v4()}.tmp"
  if cb?
    fs.writeFile tmpFileName, json, 'utf8', (err) ->
      return cb err if err
