Index: /trunk/zoo-project/zoo-kernel/service_internal.c
===================================================================
--- /trunk/zoo-project/zoo-kernel/service_internal.c	(revision 480)
+++ /trunk/zoo-project/zoo-kernel/service_internal.c	(revision 481)
@@ -2092,15 +2092,16 @@
   int nsid=zooXmlAddNs(NULL,"http://www.opengis.net/ows","ows");
   ns=usedNs[nsid];
+  if(use_ns==1){
+    ns=NULL;
+  }
   n = xmlNewNode(ns, BAD_CAST "ExceptionReport");
-
   if(use_ns==1){
-    ns_ows=xmlNewNs(n,BAD_CAST "http://www.opengis.net/ows/1.1.0",BAD_CAST "ows");
+    ns_ows=xmlNewNs(n,BAD_CAST "http://www.opengis.net/ows/1.1",NULL);
     int xsiId=zooXmlAddNs(n,"http://www.w3.org/2001/XMLSchema-instance","xsi");
     ns_xsi=usedNs[xsiId];
-    ns_xsi=xmlNewNs(n,BAD_CAST "http://www.w3.org/2001/XMLSchema-instance",BAD_CAST "xsi");
     xmlNewNsProp(n,ns_xsi,BAD_CAST "schemaLocation",BAD_CAST "http://www.opengis.net/ows/1.1 http://schemas.opengis.net/ows/1.1.0/owsExceptionReport.xsd");
-    int xlinkId=zooXmlAddNs(n,"http://www.w3.org/1999/xlink","xlink");
-    ns_xlink=usedNs[xlinkId];
-  }
+  }
+
+
   addLangAttr(n,m);
   xmlNewProp(n,BAD_CAST "version",BAD_CAST "1.1.0");
@@ -2194,25 +2195,4 @@
   }
   
-  if(res==SERVICE_FAILED){
-    map * errormap;
-    map *lenv;
-    lenv=getMapFromMaps(m,"lenv","message");
-    char *tmp0;
-    if(lenv!=NULL){
-      tmp0=(char*)malloc((strlen(lenv->value)+strlen(_("Unable to run the Service. The message returned back by the Service was the following: "))+1)*sizeof(char));
-      sprintf(tmp0,_("Unable to run the Service. The message returned back by the Service was the following: %s"),lenv->value);
-    }
-    else{
-      tmp0=(char*)malloc((strlen(_("Unable to run the Service. No more information was returned back by the Service."))+1)*sizeof(char));
-      sprintf(tmp0,_("Unable to run the Service. No more information was returned back by the Service."));
-    }
-    errormap = createMap("text",tmp0);
-    free(tmp0);
-    addToMap(errormap,"code", "InternalError");
-    printExceptionReportResponse(m,errormap);
-    freeMap(&errormap);
-    free(errormap);
-    return;
-  }
 
   if(asRaw==0){
@@ -2342,4 +2322,25 @@
     }
     else{
+      if(res==SERVICE_FAILED){
+	map * errormap;
+	map *lenv;
+	lenv=getMapFromMaps(m,"lenv","message");
+	char *tmp0;
+	if(lenv!=NULL){
+	  tmp0=(char*)malloc((strlen(lenv->value)+strlen(_("Unable to run the Service. The message returned back by the Service was the following: "))+1)*sizeof(char));
+	  sprintf(tmp0,_("Unable to run the Service. The message returned back by the Service was the following: %s"),lenv->value);
+	}
+	else{
+	  tmp0=(char*)malloc((strlen(_("Unable to run the Service. No more information was returned back by the Service."))+1)*sizeof(char));
+	  sprintf(tmp0,_("Unable to run the Service. No more information was returned back by the Service."));
+	}
+	errormap = createMap("text",tmp0);
+	free(tmp0);
+	addToMap(errormap,"code", "InternalError");
+	printExceptionReportResponse(m,errormap);
+	freeMap(&errormap);
+	free(errormap);
+	return;
+      }
       /**
        * We get the requested output or fallback to the first one if the 
Index: /trunk/zoo-project/zoo-kernel/zoo_service_loader.c
===================================================================
--- /trunk/zoo-project/zoo-kernel/zoo_service_loader.c	(revision 480)
+++ /trunk/zoo-project/zoo-kernel/zoo_service_loader.c	(revision 481)
@@ -791,8 +791,4 @@
     freeMaps(&m);
     free(m);
-    if(request_inputs!=NULL){
-      freeMap(&request_inputs);
-      free(request_inputs);
-    }
     return 1;
   }
