fix a bug that command output clobbered the log file