bug fix for date range