Fixing bug with dates