Fix after upgrade and issues from FindBugs