Fixed sentinel logic in dequeue