fixes bugs found by findbugs