Fixed bugs found by FindBugs