Fix issues reported by FindBugs
Add logging