Two bug fixes

Two simple bug fixes - the issues referenced in the comments explain what is being fixed.