fix printing to log file, fix run