Fixed some problems reported by FindBugs