fixed issues found by scan-build