build and coverity fixes

Two patches to fix a compiler warning and one coverity issue.