Misc fixes

Two unrelated patches fixing minor bugs.