Replace old style "defined?" checks with new style @var checks.

Since defined? passes when the variable is defined as undef, use the @var checks instead.