Replace process.nextTick with setImmediate.