fix bugs in _task_sched