Bug fixes for scheduling.