Various mini fixes based on IntelliJ's inspection