Bugfix in the endtime for periods