Added more checks in scheduler.