Fixed scheduling bugs