Fixed the timetable_exists function