Fixes for Coverity issues