fix scheduling bug