with fallback to setImmediate and setTimeout