Coverity fixes

A few issues identified by ceoverity.