Fix a bunch of IntelliJ inspection warnings.