Fix possible bugs found with FindBugs