Fix issues in scheduler.