Cleanup of various little things

Still more work to be done with addressing issues found by coverity