fixes an error when a date is null