scheduler bug fixed, tests added