tweaking the tick scheduling to include setImmediate as well, if present