Fixed to write to log file.