Assorted minor bug fixes