Fix sonar major errors