Moreover, since you removed the renaming function, there is no reason to keep tlog_logfile_save, hence no reason for the fist if clause