Fixes to schedule module and state for error conditions.

Fixes to schedule module and state for error conditions.