fixed wrong counting of dates