diff --git a/utils/fix_links.py b/utils/fix_links.py
index 6994776d9ac669a85ad3515b6113f55eeab028cd..0b8160f65180d840bb624b25705ce3c4e2c7fd2d 100644
--- a/utils/fix_links.py
+++ b/utils/fix_links.py
@@ -81,10 +81,15 @@ def fix_links( links, credentials=None ):
         if 'description' in link.keys():
             fixed_links[k]['description'] = re.sub(r'\(OGC:WMS\)|\(OGC:WCS\)|\(OGC:WFS\)|\(OGC:SOS\)', '', link['description']).strip()
 
-        # # FIX links pointing to external websites
-        # #logging.debug(link)
-        # if (link['protocol'] == 'WWW-LINK' and link['content-type'] == 'WWW:LINK'):
-        #     fixed_links[k]['protocol'] = 'HTML'
+        # KML
+        if 'protocol' in link.keys() and link['protocol'] == "application/vnd.google-earth.kml+xml":
+            fixed_links[k]['protocol'] = 'KML'
+            continue
+
+        # SOS
+        if 'protocol' in link.keys() and '/sos/' in link['url'].lower():
+            fixed_links[k]['protocol'] = 'SOS'
+            continue
 
         # FIX links in which the declared protocol is as bizarre as "WWW:LINK-1.0-http--link"
         # The KML protocol needs also to be fixed.
@@ -127,14 +132,6 @@ def fix_links( links, credentials=None ):
             except Exception as e:
                 logging.debug(e)
 
-                # KML
-                if link['protocol'] == "application/vnd.google-earth.kml+xml":
-                    fixed_links[k]['protocol'] = 'KML'
-
-                # SOS
-                if '/sos/' in link['url'].lower():
-                    fixed_links[k]['protocol'] = 'SOS'
-
                 # ...otherwise, we make a guess on the basis of the information carried by the URL
                 known_formats = ['ecw', 'pdf', 'zip', 'json', 'tif', 'tiff', 'csv']