   for provision, j in provisions
     counter += 2
     globals = {args: provision.slice(1)}
-    do (j) -> sandbox.run(allVirtualParameters[provision[0]].script, globals,
+    do (provision, j) -> sandbox.run(allVirtualParameters[provision[0]].script, globals,
       sessionContext, startRevision, endRevision,
       (err, _fault, _clear, _declarations, _done, _returnValue) ->
         if err or _fault

  if not vparams
    return callback()

  toClear = null
  for vpu, i in ret
    toClear = commitVirtualParameter(sessionContext, vparams[i], vpu, toClear)

  clear(sessionContext, toClear, (err) ->
    return rpcRequest(sessionContext, null, callback)

        done &&= _done
        allDeclarations[j] = _declarations or []
        allClear[j] = _clear or []
        if _done
          if not _returnValue
            if counter & 1
              callback(null, {code: 'script', message: 'Invalid virtual parameter return value'})
            return counter = 0

          ret = {}

          if _returnValue.writable?
            ret.writable = +!!_returnValue.writable
          else if provision[1].writable? or provision[2].writable?
            if counter & 1
              callback(null, {code: 'script', message: 'Virtual parameter must provide declared attributes'})
            return counter = 0

          if _returnValue.value?
            ret.value = device.sanitizeParameterValue(_returnValue.value)
          else if provision[1].value? or provision[2].value?
            if counter & 1
              callback(null, {code: 'script', message: 'Virtual parameter must provide declared attributes'})
            return counter = 0

          virtualParameterUpdates[j] = ret

        if (counter -= 2) == 1
          allDeclarations = Array.prototype.concat.apply([], allDeclarations)
