Coverity

Patch up some coverity issues and clang warnings.