fixing issues found by clang static analyzer