counting remaining task by checking all the task states

double checking the task states instead of relying on previous job.RemainTasks