Fixed sonar warnings