fixes bugs found by findbugs
Merge pull request #1697 from enesakar/maintenance-findbugs

fixes bugs found by findbugs