Fixes and tests.
Fixed deletion bug for schedules.