Fix issues found by Coverity