Fixing sonar violations