Fix bug when daysOfWeek = 7