try to make setImmediate fit more condition