Miscellaneous fixes pointed out by tshirtman