Fixed bug in prioritizing tasks.