if setImmediate is supported, use setImmediate instead of setTimeout