Fix for node 0.10: use setImmediate()

In node 0.10 using recursive process.nextTick() calls breaks ('resulting in a maximum call stack size exceeded'). Use setImmediate() instead.