improved handling of date