Fix bug with priorities when adding multiple tasks.