fix several Coverity issues