Reduce print output. Fix conditional for log writing.