diff --git a/server.py b/server.py
index 56b18229fd542c776c9eee8153db69d7b0a5cd4a..3ecb26c1682189e9c2ba3018eaabc4e47038aa6b 100644
--- a/server.py
+++ b/server.py
@@ -51,16 +51,19 @@ def validate():
     version = request.args.get('v')
     xml_str = request.data
     xml_tree = utils.parse(xml_str)
-    if xml_tree:
+    try:
+        utils.parse(xml_str)
         app.logger.debug('=== xml_tree OK ===')
         xsd_str = utils.get_xsd(releases_dict, xsd_version=version, xml_str=xml_str)
         if  xsd_str:
+            app.logger.debug('=== xsd OK ===')
             ret = utils.validate(xml_str=xml_str, xsd_str=xsd_str)
         else:
+            app.logger.debug('=== xsd invalid ===')
             ret = utils.return_error(error='xsd content not readable')
-    else: 
-        app.logger.debug('=== xml_tree invalid ===') 
-        ret = utils.return_error(error='invalid xml data')
+    except:
+        app.logger.debug('=== xml_tree invalid ===')
+        ret = utils.return_error(error='invalid xml data')   
 
     return  utils.xml_response(ret)
     
diff --git a/utils.py b/utils.py
index f712b5e78ba9883920df43f0da9b66250b0da2ca..1c815c81e9862b3a19d9dfccf5dec287af989200 100644
--- a/utils.py
+++ b/utils.py
@@ -53,9 +53,9 @@ def get_version():
         return False
 
 def get_xsd(d, xsd_version=None, xml_str = None):
-    url = False
+    url = ''
     version = xsd_version
-    if not version: # We use the internal version information in the XML structure
+    if not version: # We use the internal version information in the XML data
         root = parse(xml_str)
         version = root.attrib.get('schemaVersion')
     for i in d['releases']: