Changed nextTick() to setImmediate() to get rid of warnings