Fix bug where log_and_report was referring to variable that doesn't exist