Coverity fixes

Fixes for coverity issues