Fix long task prioritization bug, closes #386