use setImmediate not nextTick