Fixes to schedule module and state for error conditions.
Merge pull request #13742 from garethgreenaway/schedule_fixes

Fixes to schedule module and state for error conditions.