Bugfix: fix bugs found with findbugs