Fix priority index not being set correctly

Fixes #633