Fixing next_priority identification