 
 
           os.mkdir TEMP_DIR
-          fd = fs.openSync(LOCATIONS_TEMP_FILE, 'w')
+          fd = fs.openSync(PATH + LOCATIONS_TEMP_FILE, 'w')
           for r in result.rows
             fs.writeSync fd, JSON.stringify(r) + "\n"
           fs.closeSync fd

        callWhenEnded()






      if err? then callWhenEnded(err)
      else

        reader = linereader.open PATH + file

        nextRow = ->
          if reader.hasNextLine()
            JSON.parse reader.nextLine()
          else
            null

        # update synchronously
        upsert = do -> 
