Implement GET /api/schedules/<id> and fix some bugs