tried to make the date parsing more robust