Misc fixes

I am in the process of cleaning up some rather substantial changes for another pull request. There are several small one-liner fixes in my local branch that probably should be put into a separate pull request.