fix some issues caught by coverity