 pg = require 'pg'
 pgurl = dbconf.postgres
 
-DEBUG_updateRowsLimit = null   # set for debugging
+DEBUG_updateRowsLimit = 10   # set for debugging
 OMIT_NULL_VALUE_FIELDS_IN_COMMITMENTS_JSON = false
  
 PATH = "data/imports/"
 TEMP_DIR = "temp"
-AIDDATA_TEMP_FILE = TEMP_DIR + "/aiddata.json"
-LOCATIONS_TEMP_FILE = TEMP_DIR + "/locations.json"
+AIDDATA_TEMP_FILE = PATH + TEMP_DIR + "/aiddata.json"
+LOCATIONS_TEMP_FILE = PATH + TEMP_DIR + "/locations.json"
 
 USE_MONGOIMPORT = true
 

    console.log "> Export aiddata commitments from PostgreSQL to a temporary file"

    os.mkdir TEMP_DIR
    fd = fs.openSync(PATH + AIDDATA_TEMP_FILE, 'w')

    query = pgclient.query "SELECT * FROM aiddata2 #{if DEBUG_updateRowsLimit? then 'LIMIT '+DEBUG_updateRowsLimit}"
    query.on 'row', (row) ->

      if err? then callWhenEnded(err)
      else

        reader = linereader.open file

        nextRow = ->
          if reader.hasNextLine()
