corrected code wrt some IntelliJ warnings