fix various findbugs errors categorized CORRECTNESS and BAD_PRACTICE

**please review**
Too bad, it's a bug. I'm fixing a bug.