Fix logic error with hasUnfinishedTasks