Miscellaneous fixes

This fixes a few minor problems I've bumped into.