Some fixes from IDEA code analysis.