fixed bug causing wrongly added dates