scheduling cleanup and bug fix