modify checking number of tasks