Fix ignoring the range end date