use setImmediate in iterator.js