fixed bug if date field is empty/nil