Fixed Schedule to include CanceledSchedule in query;

Minor refactorings to SyncProgramStates (TVLIB-66)