some by coverity inspired cleanup