Fix some minor coverity issues and one bit of SPaG