Use setTimeout instead of setImmediate when setImmediate is not available