You're using util.isUndefined() here but a regular 'is truthy' check a few lines up.  Is that intentional?