Fixed issues found with clang-analyzer