fix some problems with date parsing