fix bug of log date and beautify code