@tzz please review these changes. They eliminate undef-value warnings, but please make sure they do not have unintended consequences.