date range bug fix