         path += p + '.'
         projection[path + '_timestamp'] = 1
 
-    db.devicesCollection.findOne({'_id' : deviceId}, projection, (err, device) ->
+    db.devicesCollection.findOne({'_id' : currentRequest.deviceId}, projection, (err, device) ->
       throw err if err
       lastBootstrap ?= device?._lastBootstrap
       _tasks = []


  now = new Date(Date.now())

  deviceId = common.getDeviceId(cwmpRequest.methodRequest.deviceId)
  currentRequest.deviceId = deviceId
  util.log("#{deviceId}: Inform (#{cwmpRequest.methodRequest.event}); retry count #{cwmpRequest.methodRequest.retryCount}") if config.LOG_INFORMS

  parameterNames = (p[0] for p in cwmpRequest.methodRequest.parameterList)


  actions.set._lastBoot = now if '1 BOOT' in cwmpRequest.methodRequest.event
  actions.set._lastBootstrap = lastBootstrap = now if '0 BOOTSTRAP' in cwmpRequest.methodRequest.event

  db.redisClient.get("#{currentRequest.deviceId}_inform_hash", (err, res) ->
    throw err if err

    if not res?
      db.redisClient.setex("#{currentRequest.deviceId}_inform_hash", config.PRESETS_CACHE_DURATION, informHash, (err, res) ->
        throw err if err
      )

    updateAndRespond = () ->
      updateDevice(currentRequest, actions, (err) ->
        throw err if err
        res = tr069.response(cwmpRequest.id, {methodResponse : {type : 'InformResponse'}}, {deviceId : currentRequest.deviceId})
        writeResponse(currentRequest, res)
      )

