Fix priority index not being set correctly