various coverity fixes