Bug fix: infinite loop for one task.