Improved dateformat, fixed some bug