Various small code style fixes / bug fixes