fixing major issues identified by FindBugs