Index: trunk/zoo-project/zoo-kernel/caching.c
===================================================================
--- trunk/zoo-project/zoo-kernel/caching.c	(revision 735)
+++ trunk/zoo-project/zoo-kernel/caching.c	(revision 738)
@@ -303,5 +303,5 @@
  */
 int loadRemoteFile(maps** m,map** content,HINTERNET* hInternet,char *url){
-  char* fcontent;
+  char* fcontent = NULL;
   char* cached=isInCache(*m,url);
   char *mimeType=NULL;
@@ -353,5 +353,5 @@
 
   tmpMap->value=(char*)malloc((fsize+1)*sizeof(char));
-  if(tmpMap->value==NULL)
+  if(tmpMap->value==NULL || fcontent == NULL)
     return errorException(*m, _("Unable to allocate memory"), "InternalError",NULL);
   memcpy(tmpMap->value,fcontent,(fsize+1)*sizeof(char));
Index: trunk/zoo-project/zoo-kernel/response_print.c
===================================================================
--- trunk/zoo-project/zoo-kernel/response_print.c	(revision 735)
+++ trunk/zoo-project/zoo-kernel/response_print.c	(revision 738)
@@ -786,5 +786,6 @@
 void printDescribeProcessForProcess(registry *reg, maps* m,xmlNodePtr nc,service* serv){
   xmlNsPtr ns,ns_ows,ns_xlink;
-  xmlNodePtr n,nc1,nc2;
+  xmlNodePtr n,nc1;
+  xmlNodePtr nc2 = NULL;
   map* version=getMapFromMaps(m,"main","rversion");
   int vid=getVersionId(version->value);
@@ -872,5 +873,5 @@
   if(vid==0)
     xmlAddChild(n,nc);
-  else{
+  else if (nc2 != NULL) {	  
     xmlAddChild(nc2,nc);
     xmlAddChild(n,nc2);
Index: trunk/zoo-project/zoo-kernel/service.c
===================================================================
--- trunk/zoo-project/zoo-kernel/service.c	(revision 735)
+++ trunk/zoo-project/zoo-kernel/service.c	(revision 738)
@@ -455,6 +455,7 @@
  * @param v the corresponding value to add
  * @param size the size of the given value
- */
-void addToMapWithSize(map* m,const char* n,const char* v,int size){
+ * @return a pointer to the updated map m
+ */
+map* addToMapWithSize(map* m,const char* n,const char* v,int size){
   if(hasKey(m,n)==false){
     map* _cursor=m;
@@ -477,4 +478,5 @@
   sprintf(sin,"%d",size);
   addToMap(m,sname,sin);
+  return m;
 }
 
Index: trunk/zoo-project/zoo-kernel/service.h
===================================================================
--- trunk/zoo-project/zoo-kernel/service.h	(revision 735)
+++ trunk/zoo-project/zoo-kernel/service.h	(revision 738)
@@ -292,5 +292,5 @@
   ZOO_DLL_EXPORT void addToMap(map*,const char*,const char*);
   ZOO_DLL_EXPORT void addIntToMap(map*,const char*,const int);
-  ZOO_DLL_EXPORT void addToMapWithSize(map*,const char*,const char*,int);
+  ZOO_DLL_EXPORT map* addToMapWithSize(map*,const char*,const char*,int);
   ZOO_DLL_EXPORT void addMapToMap(map**,map*);
   ZOO_DLL_EXPORT void addMapToIoType(iotype**,map*);
Index: trunk/zoo-project/zoo-kernel/service_internal.c
===================================================================
--- trunk/zoo-project/zoo-kernel/service_internal.c	(revision 735)
+++ trunk/zoo-project/zoo-kernel/service_internal.c	(revision 738)
@@ -189,6 +189,6 @@
   sprintf (fbkpid, "%s/%s.status", r_inputs->value, lid);
   FILE* f0 = fopen (fbkpid, "r");
-  if(f0!=NULL){
-    semid lockid;
+  if(f0!=NULL){    
+    semid lockid = NULL;
     char* stat;
     long flen;
@@ -270,6 +270,6 @@
   if(status!=NULL && msg!=NULL &&
      status->value!=NULL && msg->value!=NULL && 
-     strlen(status->value)>0 && strlen(msg->value)>1){
-    semid lockid;
+     strlen(status->value)>0 && strlen(msg->value)>1){    
+    semid lockid = NULL;
     char* stat=getStatusId(conf,sid->value);
     if(stat!=NULL){
Index: trunk/zoo-project/zoo-kernel/service_internal_php.c
===================================================================
--- trunk/zoo-project/zoo-kernel/service_internal_php.c	(revision 735)
+++ trunk/zoo-project/zoo-kernel/service_internal_php.c	(revision 738)
@@ -432,6 +432,6 @@
     convert_to_string(&tmpcopy);
     if(strncmp(key,"value",5)==0){
-      len=Z_STRLEN_P(&tmpcopy);
-      addToMapWithSize(final_res,key,Z_STRVAL_P(&tmpcopy),len);
+      len=Z_STRLEN_P(&tmpcopy);      
+	  final_res = addToMapWithSize(final_res,key,Z_STRVAL_P(&tmpcopy),len);
     }
     else{
Index: trunk/zoo-project/zoo-kernel/service_internal_python.c
===================================================================
--- trunk/zoo-project/zoo-kernel/service_internal_python.c	(revision 735)
+++ trunk/zoo-project/zoo-kernel/service_internal_python.c	(revision 738)
@@ -563,4 +563,43 @@
 
 /**
+ * Convert a Python dictionary to a maps 
+ *
+ * @param t the PyDictObject to convert
+ * @return a new maps containing the converted PyDictObject
+ * @warning make sure to free resources returned by this function
+ */
+maps* _mapsFromPyDict(PyDictObject* t){
+	
+	PyObject* list = PyDict_Keys((PyObject*)t); // new ref	
+	int nb = PyList_Size(list);	
+	
+	if (nb < 1) {
+		Py_DECREF(list);
+		return NULL;
+	}
+
+	maps* ptr = (maps*) malloc(MAPS_SIZE);
+	maps* res = ptr;	
+	
+	PyObject* key;
+	PyObject* value;
+	
+	for(int i = 0; i < nb; i++) {
+		
+		key = PyList_GetItem(list,i); // borrowed ref
+		value = PyDict_GetItem((PyObject*) t, key); // borrowed ref
+		
+		ptr->name = zStrdup(PyString_AsString(key));
+		ptr->content = mapFromPyDict((PyDictObject*) value);
+		
+		ptr->next = i < nb - 1 ? (maps*) malloc(MAPS_SIZE) : NULL;
+		ptr = ptr->next;
+	}
+	Py_DECREF(list);
+
+	return res;
+} // mapsFromPyDict
+
+/**
  * Convert a Python dictionary to a map 
  *
@@ -597,11 +636,13 @@
 	}
 	else{
+#ifdef DEBUG
 	  fprintf(stderr,"Unsupported return value.");
+#endif
 	  return NULL;
 	}
 #else
       PyString_AsStringAndSize(value,&buffer,&size);
-#endif
-      addToMapWithSize(res,PyString_AsString(key),buffer,size);
+#endif      
+	  res = addToMapWithSize(res,PyString_AsString(key),buffer,size);
     }else{
       char* lkey=PyString_AsString(key);
@@ -622,4 +663,77 @@
 
 /**
+ * Convert a Python dictionary to a map 
+ *
+ * @param t the PyDictObject to convert
+ * @return a new map containing the converted PyDictObject
+ * @warning make sure to free resources returned by this function
+ */
+map* _mapFromPyDict(PyDictObject* t) {
+	
+	PyObject* list = PyDict_Keys((PyObject*) t); // new ref
+	int nb = PyList_Size(list);
+	
+	if (nb < 1) {
+		Py_DECREF(list);
+		return NULL;
+	}	
+	
+	map* ptr = (map*) malloc(MAP_SIZE);
+	map* res = ptr;
+	
+	PyObject* key;
+	PyObject* value;
+	char *buffer = NULL;
+	Py_ssize_t size;
+	for(int i = 0; i < nb; i++) {
+		
+		key = PyList_GetItem(list, i); // borrowed ref
+		value = PyDict_GetItem((PyObject*) t, key); // borrowed ref		
+				
+		ptr->name = zStrdup(PyString_AsString(key));		
+		map* msize = NULL;
+		
+	#if PY_MAJOR_VERSION >= 3
+		if (PyBytes_Check(value)) {
+		// value is byte array
+			size = PyBytes_Size(value);				
+			buffer = PyBytes_AsString(value); // pointer to internal buffer
+			char sz[32];
+			sprintf(sz, "%d", (int) size);	
+			msize = createMap("size", sz);			
+		}
+		else if (PyUnicode_Check(value) && PyUnicode_READY(value) == 0) {
+		// value is string object		
+			buffer = PyUnicode_AsUTF8AndSize(value, &size);
+			size++;
+		}
+		else {
+			printf("Type not recognized\n");
+			// error handling
+			// ...
+		}
+	#else	
+		PyString_AsStringAndSize(value, &buffer, &size);
+		size++;
+		// to do: handle byte arrays
+	#endif
+		
+		ptr->value = (char*) malloc(size); // check for NULL pointer
+		memmove(ptr->value, buffer, size);
+			
+		if (msize != NULL) {
+			ptr->next = msize;
+			ptr = ptr->next;
+		}						
+		
+		ptr->next = i < nb - 1 ? (map*) malloc(MAP_SIZE) : NULL;
+		ptr = ptr->next;
+	}	
+	Py_DECREF(list);
+			
+	return res;
+} // mapFromPyDict
+
+/**
  * Use the ZOO-Services messages translation function from the Python
  * environment
Index: trunk/zoo-project/zoo-kernel/zoo_service_loader.c
===================================================================
--- trunk/zoo-project/zoo-kernel/zoo_service_loader.c	(revision 735)
+++ trunk/zoo-project/zoo-kernel/zoo_service_loader.c	(revision 738)
@@ -961,5 +961,5 @@
       setenv ("LC_ALL", tmp, 1);
 #else
-      char tmp1[12];
+	  char tmp1[13];
       sprintf (tmp1, "LC_ALL=%s", tmp);
       putenv (tmp1);
@@ -973,5 +973,5 @@
       setenv ("LC_ALL", "en_US", 1);
 #else
-      char tmp1[12];
+	  char tmp1[13];
       sprintf (tmp1, "LC_ALL=en_US");
       putenv (tmp1);
@@ -1473,6 +1473,7 @@
 	  {
 	    map* version=getMapFromMaps(m,"main","rversion");
-	    int vid=getVersionId(version->value);
-	    int len,j=0;
+	    int vid=getVersionId(version->value);	    
+		int len = 0;
+		int j = 0;
 	    for(j=0;j<nbSupportedRequests;j++){
 	      if(requests[vid][j]!=NULL)
