Fixing errors Sonar Query