Replaced deprecated process.nextTick with setImmediate

- Added test that causes Maximum call stack size exeeded error in node

Added test that causes recursion