modified dequeue