use setImmediate instead of process.nextTick