fixed sched and for loops