Fixed date comparison bug