Second wave of fixes suggested by coverity static code analyzer.