Fixed bugs shown by Intellij.