priority queue was sorting in the wrong order