fixing small loop error in new scheduling