MOD: optimize TaskWithScheduler.