fixing deprecation of recursive use of "nextTick" to use "setImmediate"