Fixed a bug in setting dates