various fixes after coverity check