A bugfix plus cleanup

The priority setting code had a bug, it passed uninitialized data.