Fixed bug on empty queue.