Fixes from coverity and clang checker. Try 2