Various Coverity fixes