Miscellaneous fixes

Too many things have been fixed for me to remember...