Fixed bugs in delay and ready queues