Fix uninitialized variable bugs

The previous few commits introduced a couple of bugs where variables
could be used without being initialized.  Fix them.