fix some bugs and change output date-string to timestamp
resolve confilcts