fixing critical bugs found with FindBugs