fix various findbugs errors categorized CORRECTNESS and BAD_PRACTICE

**please review**