More fixes for things found by Coverity