Fixed issue with date comparisons