Fix a bajillion possible bugs. (Due to FindBugs, some were actually
current bugs I'd overlooked)