Fix prioritySort for priority = 0

For #1882