Fixed IF statement in log writing.