fix empty date and date comparisons