fixed a bug on using PriorityQueue.