fix various findbugs errors categorized CORRECTNESS and BAD_PRACTICE

**please review**
Might be ok to assume the tuple elements are not null.