Changing nextTick to setImmediate.