Fixed error with priority queue