backport fixes from calendarrepo