Added missing check for non-empty next-tick queue.