fix scheduling bugs