Fix priority queue for multiple names