Fixed bugs that happened after last commit

- fixed checking for duplicate schedules