Fixes a few bugs from findbugs.