Coverity fixes

Some small minor fixes for issues found with Coverity.