fix write log to file missing bug