Fixed a few Coverity discovered issues.