Fix bugs

Correct enter in queue and leave queue.