Fixing scoping issue with the log variable.