some code fixes and fix date format