Fixed a bug in date range