fix various issues found by findBugs