better protection against empty dates