Coverity fixes

A few fixes to some things coverity detected.