out-of-index bug fixed in scheduler.py