Fix the queue functionality