Minor bug fixes highlighted by Adam