Fix missing require, log only if $log exists