Fixing some date comparisons