Fixes for coverity issues