Fixing a date setting bug