Fixed bugs found with FindBugs