fixed some scheduling bugs