fix handling of null dates