diff --git a/compiler2/ttcn3/Statement.cc b/compiler2/ttcn3/Statement.cc
index e831aba13d33f340272f2459f1e6226852a4d796..a1fba6d61ab9b710564c5ddb94443f33475b77a7 100644
--- a/compiler2/ttcn3/Statement.cc
+++ b/compiler2/ttcn3/Statement.cc
@@ -7446,6 +7446,39 @@ error:
   {
     expression_struct expr;
     Code::init_expr(&expr);
+    bool warning = false;
+    if (!config_op.compref1->get_expr_governor(Type::EXPECTED_DYNAMIC_VALUE)) {
+      warning = true;
+      if (strcmp(opname, "map") == 0) {
+        config_op.compref2->warning(
+          "Cannot determine the type of the component in the first parameter."
+          "The port translation will not work.");
+      }
+    }
+    if (!config_op.compref2->get_expr_governor(Type::EXPECTED_DYNAMIC_VALUE)) {
+      warning = true;
+      if (strcmp(opname, "map") == 0) {
+        config_op.compref2->warning(
+          "Cannot determine the type of the component in the second parameter."
+          "The port translation will not work.");
+      }
+    }
+    if (config_op.translate == true && warning == false) {
+      expr.expr = mputstr(expr.expr, "if (!(");
+      config_op.portref1->generate_code_portref(&expr, my_sb);
+      expr.expr = mputstr(expr.expr, ".port_is_started())) {\n");
+      config_op.portref1->generate_code_portref(&expr, my_sb);
+      expr.expr = mputstr(expr.expr, ".activate_port(TRUE);\n");
+      config_op.portref1->generate_code_portref(&expr, my_sb);
+      expr.expr = mputstr(expr.expr, ".start();\n}\n");
+      expr.expr = mputstr(expr.expr, "if (!(");
+      config_op.portref2->generate_code_portref(&expr, my_sb);
+      expr.expr = mputstr(expr.expr, ".port_is_started())) {\n");
+      config_op.portref2->generate_code_portref(&expr, my_sb);
+      expr.expr = mputstr(expr.expr, ".activate_port(TRUE);\n");
+      config_op.portref2->generate_code_portref(&expr, my_sb);
+      expr.expr = mputstr(expr.expr, ".start();\n}\n");
+    }
     expr.expr = mputprintf(expr.expr, "TTCN_Runtime::%s_port(", opname);
     config_op.compref1->generate_code_expr(&expr);
     expr.expr = mputstr(expr.expr, ", ");
@@ -7472,28 +7505,18 @@ error:
       // a simple string shall be formed from the port name and array indices
       generate_code_portref(&expr, config_op.portref2);
     }
+    if (config_op.translate == true && warning == false) {
+      expr.expr = mputstr(expr.expr, ", TRUE");
+    }
     expr.expr = mputstr(expr.expr, ")");
-    if (config_op.translate) {
-      bool warning = false;
-      if (!config_op.compref1->get_expr_governor(Type::EXPECTED_DYNAMIC_VALUE)) {
-        warning = true;
-        config_op.compref2->warning(
-          "Cannot determine the type of the component in the first parameter."
-          "The port translation will not work.");
-      }
-      if (!config_op.compref2->get_expr_governor(Type::EXPECTED_DYNAMIC_VALUE)) {
-        warning = true;
-        config_op.compref2->warning(
-          "Cannot determine the type of the component in the second parameter."
-          "The port translation will not work.");
-      }
+    if (config_op.translate == true) {
       string funcname;
       if (strcmp(opname, "map") == 0) {
         funcname = "add_port";
       } else if (strcmp(opname, "unmap") == 0) {
         funcname = "remove_port";
       } else {
-        //TODO connect, disconnect
+        //connect, disconnect are not supported
       }
       if (!funcname.empty() && warning == false) {
         expr.expr = mputstr(expr.expr, ";\n");
diff --git a/compiler2/ttcn3/Ttcnstuff.cc b/compiler2/ttcn3/Ttcnstuff.cc
index 18c882d9c8555b784a97a89ccb4640c5dadf967b..cac1d57c8cb2c917b060f54f4d38965ee8d9ed7a 100644
--- a/compiler2/ttcn3/Ttcnstuff.cc
+++ b/compiler2/ttcn3/Ttcnstuff.cc
@@ -2453,6 +2453,24 @@ namespace Ttcn {
     defPortClass(&pdef, target);
     if (generate_skeleton && testport_type != TP_INTERNAL &&
         (port_type != PT_USER || !legacy)) generateTestPortSkeleton(&pdef);
+    
+    
+    // Add includes for the mapped types if necessary
+    if (port_type == PT_PROVIDER) {
+      for (size_t i = 0; i < mapper_types.size(); i++) {
+        const Identifier& port_mod_name = mapper_types[i]->get_my_scope()->get_scope_mod()->get_modid();
+        const string& my_mod_name = my_type->get_my_scope()->get_scope_mod()->get_modid().get_ttcnname();
+        if (my_mod_name == port_mod_name.get_ttcnname()) {
+          continue;
+        }
+        char * incl = mprintf("#include \"%s.hh\"\n",
+          duplicate_underscores ? port_mod_name.get_name().c_str() : port_mod_name.get_ttcnname().c_str());
+        if (strstr(target->header.includes, incl) == NULL) {
+          target->header.includes = mputstr(target->header.includes, incl);
+        }
+        Free(incl);
+      }
+    }
 
     Free(pdef.msg_in.elements);
     for (size_t i = 0; i < pdef.msg_out.nElements; i++)
diff --git a/compiler2/ttcn3/port.c b/compiler2/ttcn3/port.c
index ad68292332a1dfedf66076f6c68741e95fa5b297..c6b9542acedabad331d4911aa856dfd0b75ff773 100644
--- a/compiler2/ttcn3/port.c
+++ b/compiler2/ttcn3/port.c
@@ -72,11 +72,11 @@ static char *generate_send_mapping(char *src, const port_def *pdef,
     if (!pdef->legacy && pdef->port_type == USER) {
       // Mappings should only happen if the port it is mapped to has the same
       // outgoing message type as the mapping target.
-      src = mputstr(src, "if (false");
+      src = mputstr(src, "if (FALSE");
       for (size_t j = 0; j < pdef->provider_msg_outlist.nElements; j++) {
         for (size_t k = 0; k < pdef->provider_msg_outlist.elements[j].n_out_msg_type_names; k++) {
           if (strcmp(target->target_name, pdef->provider_msg_outlist.elements[j].out_msg_type_names[k]) == 0) {
-            src = mputprintf(src, " || p_%i != NULL", (int)j);
+            src = mputprintf(src, " || n_%i != 0", (int)j);
           }
         }
       }
@@ -268,9 +268,6 @@ static char *generate_incoming_mapping(char *src, const port_def *pdef,
       /* has_buffer will be set to TRUE later */
     }
     if (!pdef->legacy && pdef->port_type == USER) {
-      // Beginning of the loop of the PARTIALLY_TRANSLATED case to process all
-      // messages
-      src = mputstr(src, "do {\n");
       src = mputstr(src, "TTCN_Runtime::set_translation_mode(TRUE, this);\n");
       src = mputstr(src, "TTCN_Runtime::set_port_state(-1, \"by test environment.\", TRUE);\n");
     }
@@ -435,9 +432,6 @@ static char *generate_incoming_mapping(char *src, const port_def *pdef,
       report_error = TRUE;
     }
     if (mapped_type->nTargets > 1) src = mputstr(src, "}\n");
-    if (pdef->port_type == USER && !pdef->legacy) {
-      src = mputstr(src, "} while (port_state == PARTIALLY_TRANSLATED);\n");
-    }
   } /* next mapping target */
   if (has_discard) {
     if (mapped_type->nTargets > 1) {
@@ -1674,7 +1668,9 @@ void defPortClass(const port_def* pdef, output_struct* output)
     def = mputstr(def, "private:\n");
     // Port type variables which can be the mapped ports for translation
     for (i = 0; i < pdef->provider_msg_outlist.nElements; i++) {
-      def = mputprintf(def, "%s* p_%i;\n", pdef->provider_msg_outlist.elements[i].name, (int)i);
+      def = mputprintf(def,
+        "%s** p_%i;\n"
+        "size_t n_%i;\n", pdef->provider_msg_outlist.elements[i].name, (int)i, (int)i);
     }
     def = mputstr(def, "translation_port_state port_state;\n");
     
@@ -1703,7 +1699,9 @@ void defPortClass(const port_def* pdef, output_struct* output)
   if (pdef->n_mapper_name > 0) {
     def = mputstr(def, "private:\n");
     for (i = 0; i < pdef->n_mapper_name; i++) {
-      def = mputprintf(def, "%s* p_%i;\n", pdef->mapper_name[i], (int)i);
+      def = mputprintf(def,
+        "%s** p_%i;\n"
+        "size_t n_%i;\n", pdef->mapper_name[i], (int)i, (int)i);
     }
   }
   
@@ -1728,13 +1726,17 @@ void defPortClass(const port_def* pdef, output_struct* output)
     "proc_queue_tail = NULL;\n");
   if (pdef->port_type == USER && !pdef->legacy) {
     for (i = 0; i < pdef->provider_msg_outlist.nElements; i++) {
-      src = mputprintf(src, "p_%i = NULL;\n", (int)i);
+      src = mputprintf(src,
+        "p_%i = NULL;\n"
+        "n_%i = 0;\n", (int)i, (int)i);
     }
     src = mputprintf(src, "port_state = UNSET;\n");
   }
   // Port type variables in the provider types.
   for (i = 0; i < pdef->n_mapper_name; i++) {
-    src = mputprintf(src, "p_%i = NULL;\n", (int)i);
+    src = mputprintf(src,
+      "p_%i = NULL;\n"
+      "n_%i = 0;\n", (int)i, (int)i);
   }
   src = mputstr(src, "}\n\n");
 
@@ -2116,17 +2118,48 @@ void defPortClass(const port_def* pdef, output_struct* output)
     // add_port and remove_port is called after the map and unmap statements.
     for (i = 0; i < pdef->provider_msg_outlist.nElements; i++) {
       def = mputprintf(def, "void add_port(%s* p);\n", pdef->provider_msg_outlist.elements[i].name);
-      src = mputprintf(src, "void %s::add_port(%s*p) {\np_%i = p;\n}\n\n", class_name, pdef->provider_msg_outlist.elements[i].name, (int)i);
+      src = mputprintf(src,
+        "void %s::add_port(%s*p) {\n"
+        "n_%i++;\n"
+        "p_%i = static_cast<%s**>(Realloc(p_%i, n_%i * sizeof(%s*)));\n"
+        "p_%i[n_%i-1] = p;\n"
+        "}\n\n",
+        class_name, pdef->provider_msg_outlist.elements[i].name, (int)i,
+        (int)i, pdef->provider_msg_outlist.elements[i].name, (int)i, (int)i,
+        pdef->provider_msg_outlist.elements[i].name, (int)i, (int)i);
       
-      def = mputprintf(def, "void remove_port(%s*);\n", pdef->provider_msg_outlist.elements[i].name);
-      src = mputprintf(src, "void %s::remove_port(%s*) {\np_%i = NULL;\n}\n\n", class_name, pdef->provider_msg_outlist.elements[i].name, (int)i);
+      def = mputprintf(def, "void remove_port(%s* p);\n", pdef->provider_msg_outlist.elements[i].name);
+      src = mputprintf(src,
+        "void %s::remove_port(%s* p) {\n"
+        "for (size_t i = 0; i < n_%i; i++) {\n"
+        "if (p_%i[i] == p) {\n"
+        "p_%i[i]->remove_port(static_cast<%s*>(this));\n"
+        "p_%i[i] = NULL;\n"
+        "}\n"
+        "}\n"
+        "size_t size = 0;\n"
+        "%s** port_list = NULL;\n"
+        "for (size_t i = 0; i < n_%i; i++) {\n"
+        "if (p_%i[i] != NULL) {\n"
+        "size++;\n"
+        "port_list = static_cast<%s**>(Realloc(port_list, size * sizeof(%s*)));\n"
+        "port_list[size-1] = p_%i[i];\n"
+        "}\n"
+        "}\n"
+        "Free(p_%i);\n"
+        "p_%i = port_list;\n"
+        "n_%i = size;\n"
+        "}\n\n", class_name, pdef->provider_msg_outlist.elements[i].name, (int)i, (int)i,
+        (int)i, pdef->name, (int)i, pdef->provider_msg_outlist.elements[i].name, (int)i, (int)i,
+        pdef->provider_msg_outlist.elements[i].name, pdef->provider_msg_outlist.elements[i].name,
+        (int)i, (int)i, (int)i, (int)i);
     }
     
     // in_translation_mode returns true if one of the port type variables are not null
     def = mputstr(def, "boolean in_translation_mode() const;\n");
     src = mputprintf(src, "boolean %s::in_translation_mode() const {\nreturn ", class_name);
     for (i = 0; i < pdef->provider_msg_outlist.nElements; i++) {
-      src = mputprintf(src, "p_%i != NULL%s",
+      src = mputprintf(src, "n_%i != 0%s",
         (int)i,
         i != pdef->provider_msg_outlist.nElements - 1 ? " || " : "");
     }
@@ -2143,7 +2176,13 @@ void defPortClass(const port_def* pdef, output_struct* output)
     def = mputstr(def, "void reset_port_variables();\n");
     src = mputprintf(src, "void %s::reset_port_variables() {\n", class_name);
     for (i = 0; i < pdef->provider_msg_outlist.nElements; i++) {
-      src = mputprintf(src, "p_%i = NULL;\n", (int)i);
+      src = mputprintf(src,
+        "for (size_t i = 0; i < n_%i; i++) {\n"
+        "p_%i[i]->remove_port(static_cast<%s*>(this));\n"
+        "}\n"
+        "Free(p_%i);\n"
+        "p_%i = NULL;\n"
+        "n_%i = 0;\n", (int)i, (int)i, pdef->name, (int)i, (int)i, (int)i);
     }
     src = mputstr(src, "}\n\n");
     
@@ -2154,17 +2193,49 @@ void defPortClass(const port_def* pdef, output_struct* output)
     // add_port and remove_port is called after the map and unmap statements.
     for (i = 0; i < pdef->n_mapper_name; i++) {
       def = mputprintf(def, "void add_port(%s* p);\n", pdef->mapper_name[i]);
-      src = mputprintf(src, "void %s::add_port(%s*p) {\n p_%i = p;\n}\n\n", class_name, pdef->mapper_name[i], (int)i);
+      src = mputprintf(src,
+        "void %s::add_port(%s*p) {\n"
+        "n_%i++;\n"
+        "p_%i = static_cast<%s**>(Realloc(p_%i, n_%i * sizeof(%s*)));\n"
+        "p_%i[n_%i-1] = p;\n"
+        "}\n\n", class_name, pdef->mapper_name[i], (int)i, (int)i,
+        pdef->mapper_name[i], (int)i, (int)i, pdef->mapper_name[i],
+        (int)i, (int)i);
       
       def = mputprintf(def, "void remove_port(%s*);\n", pdef->mapper_name[i]);
-      src = mputprintf(src, "void %s::remove_port(%s*) {\n p_%i = NULL;\n}\n\n", class_name, pdef->mapper_name[i], (int)i);
+      src = mputprintf(src,
+        "void %s::remove_port(%s* p) {\n"
+        "for (size_t i = 0; i < n_%i; i++) {\n"
+        "if (p_%i[i] == p) {\n"
+        "p_%i[i] = NULL;\n"
+        "}\n"
+        "}\n"
+        "size_t size = 0;\n"
+        "%s** port_list = NULL;\n"
+        "for (size_t i = 0; i < n_%i; i++) {\n"
+        "if (p_%i[i] != NULL) {\n"
+        "size++;\n"
+        "port_list = static_cast<%s**>(Realloc(port_list, size * sizeof(%s*)));\n"
+        "port_list[size-1] = p_%i[i];\n"
+        "}\n"
+        "}\n"
+        "Free(p_%i);\n"
+        "p_%i = port_list;\n"
+        "n_%i = size;\n"
+        "}\n\n", class_name, pdef->mapper_name[i], (int)i,
+        (int)i, (int)i, pdef->mapper_name[i], (int)i, (int)i,
+        pdef->mapper_name[i], pdef->mapper_name[i],
+        (int)i, (int)i, (int)i, (int)i);
     }
     def = mputstr(def, "private:\n");
     // Resets all port type variables to NULL
     def = mputstr(def, "void reset_port_variables();\n");
     src = mputprintf(src, "void %s::reset_port_variables() {\n", class_name);
     for (i = 0; i < pdef->n_mapper_name; i++) {
-      src = mputprintf(src, "p_%i = NULL;\n", (int)i);
+      src = mputprintf(src,
+        "Free(p_%i);\n"
+        "p_%i = NULL;\n"
+        "n_%i = 0;\n", (int)i, (int)i, (int)i);
     }
     src = mputstr(src, "}\n\n");
   }
@@ -2221,9 +2292,11 @@ void defPortClass(const port_def* pdef, output_struct* output)
             }
             if (found) {
               src = mputprintf(src,
-                "if (p_%i != NULL) {\n"
-                "p_%i->outgoing_send(send_par);\n"
-                "return;\n}\n", (int)j, (int)j);
+                "for (size_t i = 0; i < n_%i; i++) {\n"
+                "if (p_%i[i] != NULL) {\n"
+                "p_%i[i]->outgoing_send(send_par);\n"
+                "return;\n}\n"
+                "}\n", (int)j, (int)j, (int)j);
             }
           }
           found = FALSE;
@@ -2282,9 +2355,11 @@ void defPortClass(const port_def* pdef, output_struct* output)
               }
               if (found) {
                 src = mputprintf(src,
-                  "if (p_%i != NULL) {\n"
-                  "p_%i->outgoing_send(send_par);\n"
-                  "return;\n}\n", (int)k, (int)k);
+                  "for (size_t i = 0; i < n_%i; i++) {\n"
+                  "if (p_%i[i] != NULL) {\n"
+                  "p_%i[i]->outgoing_send(send_par);\n"
+                  "return;\n}\n"
+                  "}\n", (int)k, (int)k, (int)k);
               }
             }
             found = FALSE;
@@ -2344,9 +2419,10 @@ void defPortClass(const port_def* pdef, output_struct* output)
       }
       def = mputstr(def, ") = 0;\n");
     }
-    def = mputstr(def, "public:\n");
   }
-
+  
+  def = mputstr(def, "public:\n");
+  
   /* Generic receive routines (without message type) */
   if (has_msg_queue) {
     /* generic receive function */
@@ -2609,10 +2685,12 @@ void defPortClass(const port_def* pdef, output_struct* output)
         // We forward the incoming_message to the mapped port
         for (size_t j = 0; j < pdef->n_mapper_name; j++) {
           src = mputprintf(src,
-            "if (p_%i != NULL) {\n"
-            "p_%i->incoming_message(incoming_par, sender_component);\n"
-            "return;\n}\n",
-            (int)j, (int)j);
+            "for (size_t i = 0; i < n_%i; i++) {\n"
+            "if (p_%i[i] != NULL) {\n"
+            "p_%i[i]->incoming_message(incoming_par, sender_component);\n"
+            "return;\n}"
+            "}\n",
+            (int)j, (int)j, (int)j);
         }
       }
       src = mputstr(src,
diff --git a/core/Communication.cc b/core/Communication.cc
index aa68458c8f8b80f476788739669bc3004b7d4886..34ed422203dfb49fb8b36de42c48f8a8e6a1ba81 100644
--- a/core/Communication.cc
+++ b/core/Communication.cc
@@ -1021,42 +1021,46 @@ void TTCN_Communication::send_disconnected(const char *local_port,
 }
 
 void TTCN_Communication::send_map_req(component src_component,
-  const char *src_port, const char *system_port)
+  const char *src_port, const char *system_port, boolean translation)
 {
   Text_Buf text_buf;
   text_buf.push_int(MSG_MAP_REQ);
   text_buf.push_int(src_component);
+  text_buf.push_int(translation == FALSE ? 0 : 1);
   text_buf.push_string(src_port);
   text_buf.push_string(system_port);
   send_message(text_buf);
 }
 
 void TTCN_Communication::send_mapped(const char *local_port,
-  const char *system_port)
+  const char *system_port, boolean translation)
 {
   Text_Buf text_buf;
   text_buf.push_int(MSG_MAPPED);
+  text_buf.push_int(translation == FALSE ? 0 : 1);
   text_buf.push_string(local_port);
   text_buf.push_string(system_port);
   send_message(text_buf);
 }
 
 void TTCN_Communication::send_unmap_req(component src_component,
-  const char *src_port, const char *system_port)
+  const char *src_port, const char *system_port, boolean translation)
 {
   Text_Buf text_buf;
   text_buf.push_int(MSG_UNMAP_REQ);
   text_buf.push_int(src_component);
+  text_buf.push_int(translation == FALSE ? 0 : 1);
   text_buf.push_string(src_port);
   text_buf.push_string(system_port);
   send_message(text_buf);
 }
 
 void TTCN_Communication::send_unmapped(const char *local_port,
-  const char *system_port)
+  const char *system_port, boolean translation)
 {
   Text_Buf text_buf;
   text_buf.push_int(MSG_UNMAPPED);
+  text_buf.push_int(translation == FALSE ? 0 : 1);
   text_buf.push_string(local_port);
   text_buf.push_string(system_port);
   send_message(text_buf);
@@ -1734,12 +1738,16 @@ void TTCN_Communication::process_disconnect_ack()
 
 void TTCN_Communication::process_map()
 {
+  boolean translation = incoming_buf.pull_int().get_val() == 0 ? FALSE : TRUE;
   char *local_port = incoming_buf.pull_string();
   char *system_port = incoming_buf.pull_string();
   incoming_buf.cut_message();
 
   try {
-    PORT::map_port(local_port, system_port);
+    PORT::map_port(local_port, system_port, FALSE);
+    if (translation == TRUE) {
+      PORT::map_port(local_port, system_port, TRUE);
+    }
   } catch (...) {
     delete [] local_port;
     delete [] system_port;
@@ -1769,12 +1777,16 @@ void TTCN_Communication::process_map_ack()
 
 void TTCN_Communication::process_unmap()
 {
+  boolean translation = incoming_buf.pull_int().get_val() == 0 ? FALSE : TRUE;
   char *local_port = incoming_buf.pull_string();
   char *system_port = incoming_buf.pull_string();
   incoming_buf.cut_message();
 
   try {
-    PORT::unmap_port(local_port, system_port);
+    PORT::unmap_port(local_port, system_port, FALSE);
+    if (translation == TRUE) {
+      PORT::unmap_port(local_port, system_port, TRUE);
+    }
   } catch (...) {
     delete [] local_port;
     delete [] system_port;
diff --git a/core/Communication.hh b/core/Communication.hh
index 1d3552f03ccb751381a8f86ab3e61511e52cc8e5..752617509b7ddc002285c584d034d4ee49960750 100644
--- a/core/Communication.hh
+++ b/core/Communication.hh
@@ -119,13 +119,13 @@ public:
   static void send_disconnected(const char *local_port,
     component remote_component, const char *remote_port);
   static void send_map_req(component src_component, const char *src_port,
-    const char *system_port);
+    const char *system_port, boolean translation);
   static void send_mapped(const char *local_port,
-    const char *system_port);
+    const char *system_port, boolean translation);
   static void send_unmap_req(component src_component,
-    const char *src_port, const char *system_port);
+    const char *src_port, const char *system_port, boolean translation);
   static void send_unmapped(const char *local_port,
-    const char *system_port);
+    const char *system_port, boolean translation);
 
   static void send_mtc_created();
   static void send_testcase_started(const char *testcase_module,
diff --git a/core/Port.cc b/core/Port.cc
index 15eba7dd378b337c04191e08eb6a9b9d1b202288..e89ea5314769bab435e7ed5a5439ec1d99324167 100644
--- a/core/Port.cc
+++ b/core/Port.cc
@@ -54,11 +54,14 @@
 #include "../common/dbgnew.hh"
 
 PORT *PORT::list_head = NULL, *PORT::list_tail = NULL;
+PORT *PORT::system_list_head = NULL, *PORT::system_list_tail = NULL;
 
-void PORT::add_to_list()
+void PORT::add_to_list(boolean system)
 {
+  PORT **head = system == FALSE ? &list_head : &system_list_head;
+  PORT **tail = system == FALSE ? &list_tail : &system_list_tail;
   // check for duplicate names
-  for (PORT *p = list_head; p != NULL; p = p->list_next) {
+  for (PORT *p = *head; p != NULL; p = p->list_next) {
     // do nothing if this is already a member of the list
     if (p == this) return;
     else if (!strcmp(p->port_name, port_name))
@@ -66,28 +69,37 @@ void PORT::add_to_list()
         "name %s.", port_name);
   }
   // append this to the list
-  if (list_head == NULL) list_head = this;
-  else if (list_tail != NULL) list_tail->list_next = this;
-  list_prev = list_tail;
+  if (*head == NULL) *head = this;
+  else if (*tail != NULL) (*tail)->list_next = this;
+  list_prev = *tail;
   list_next = NULL;
-  list_tail = this;
+  *tail = this;
 }
 
-void PORT::remove_from_list()
+void PORT::remove_from_list(boolean system)
 {
+  PORT **head = system == FALSE ? &list_head : &system_list_head;
+  PORT **tail = system == FALSE ? &list_tail : &system_list_tail;
+  
   if (list_prev != NULL) list_prev->list_next = list_next;
-  else if (list_head == this) list_head = list_next;
+  else if (*head == this) *head = list_next;
   if (list_next != NULL) list_next->list_prev = list_prev;
-  else if (list_tail == this) list_tail = list_prev;
+  else if (*tail == this) *tail = list_prev;
   list_prev = NULL;
   list_next = NULL;
 }
 
-PORT *PORT::lookup_by_name(const char *par_port_name)
+PORT *PORT::lookup_by_name(const char *par_port_name, boolean system)
 {
-  for (PORT *port = list_head; port != NULL; port = port->list_next)
-    if (!strcmp(par_port_name, port->port_name)) return port;
-  return NULL;
+  if (system == FALSE) {
+    for (PORT *port = list_head; port != NULL; port = port->list_next)
+      if (!strcmp(par_port_name, port->port_name)) return port;
+    return NULL;
+  } else {
+    for (PORT *port = system_list_head; port != NULL; port = port->list_next)
+      if (!strcmp(par_port_name, port->port_name)) return port;
+    return NULL;
+  }
 }
 
 struct PORT::port_parameter {
@@ -115,10 +127,12 @@ void PORT::apply_parameter(port_parameter *par_ptr)
 
 void PORT::set_system_parameters(const char *system_port)
 {
-  for (port_parameter *par = parameter_head; par != NULL; par = par->next_par)
+  for (port_parameter *par = parameter_head; par != NULL; par = par->next_par) {
     if (par->component_id.id_selector == COMPONENT_ID_SYSTEM &&
-      (par->port_name == NULL || !strcmp(par->port_name, system_port)))
+      (par->port_name == NULL || !strcmp(par->port_name, system_port))) {
       set_parameter(par->parameter_name, par->parameter_value);
+    }
+  }
 }
 
 void PORT::add_parameter(const component_id_t& component_id,
@@ -278,7 +292,7 @@ PORT::PORT(const char *par_port_name)
 
 PORT::~PORT()
 {
-  if (is_active) deactivate_port();
+  if (is_active) deactivate_port(FALSE); //TODO false or true
 }
 
 void PORT::set_name(const char * name)
@@ -293,10 +307,10 @@ void PORT::log() const
   TTCN_Logger::log_event("port %s", port_name);
   }
 
-void PORT::activate_port()
+void PORT::activate_port(boolean system)
 {
   if (!is_active) {
-    add_to_list();
+    add_to_list(system);
     is_active = TRUE;
     msg_head_count = 0;
     msg_tail_count = 0;
@@ -311,7 +325,7 @@ void PORT::activate_port()
   }
 }
 
-void PORT::deactivate_port()
+void PORT::deactivate_port(boolean system)
 {
   if (is_active) {
     /* In order to proceed with the deactivation we must ignore the
@@ -343,11 +357,11 @@ void PORT::deactivate_port()
         TitanLoggerApi::Port__Misc_reason::removing__unterminated__mapping,
         port_name, NULL_COMPREF, system_port);
       try {
-        unmap(system_port);
+        unmap(system_port, system);
       } catch (const TC_Error&) { }
       if (is_parallel) {
         try {
-          TTCN_Communication::send_unmapped(port_name, system_port);
+          TTCN_Communication::send_unmapped(port_name, system_port, system);
         } catch (const TC_Error&) { }
       }
       Free(system_port);
@@ -365,14 +379,15 @@ void PORT::deactivate_port()
     Fd_And_Timeout_User::set_timer(this, 0.0);
     // File descriptor events of port connections are removed
     // in remove_connection
-    remove_from_list();
+    remove_from_list(system);
     is_active = FALSE;
   }
 }
 
 void PORT::deactivate_all()
 {
-  while (list_head != NULL) list_head->deactivate_port();
+  while (list_head != NULL) list_head->deactivate_port(FALSE);
+  while (system_list_head != NULL) system_list_head->deactivate_port(TRUE);
 }
 
 void PORT::clear()
@@ -392,6 +407,8 @@ void PORT::all_clear()
 {
   for (PORT *port = list_head; port != NULL; port = port->list_next)
     port->clear();
+  for (PORT *port = system_list_head; port != NULL; port = port->list_next)
+    port->clear();
 }
 
 void PORT::start()
@@ -420,6 +437,8 @@ void PORT::all_start()
 {
   for (PORT *port = list_head; port != NULL; port = port->list_next)
     port->start();
+  for (PORT *port = system_list_head; port != NULL; port = port->list_next)
+    port->start();
 }
 
 void PORT::stop()
@@ -448,6 +467,8 @@ void PORT::all_stop()
 {
   for (PORT *port = list_head; port != NULL; port = port->list_next)
     port->stop();
+  for (PORT *port = system_list_head; port != NULL; port = port->list_next)
+    port->stop();
 }
 
 void PORT::halt()
@@ -474,6 +495,12 @@ void PORT::all_halt()
 {
   for (PORT *port = list_head; port != NULL; port = port->list_next)
     port->halt();
+  for (PORT *port = system_list_head; port != NULL; port = port->list_next)
+    port->halt();
+}
+
+boolean PORT::port_is_started() {
+  return is_started;
 }
 
 alt_status PORT::receive(const COMPONENT_template&, COMPONENT *, Index_Redirect*)
@@ -2133,7 +2160,7 @@ void PORT::process_last_message(port_connection *conn_ptr)
   }
 }
 
-void PORT::map(const char *system_port)
+void PORT::map(const char *system_port, boolean translation)
 {
   if (!is_active) TTCN_error("Inactive port %s cannot be mapped.", port_name);
 
@@ -2142,19 +2169,33 @@ void PORT::map(const char *system_port)
     int str_diff = strcmp(system_port, system_mappings[new_posn]);
     if (str_diff < 0) break;
     else if (str_diff == 0) {
-      TTCN_warning("Port %s is already mapped to system:%s."
-        " Map operation was ignored.", port_name, system_port);
+      if (translation == FALSE) {
+        TTCN_warning("Port %s is already mapped to system:%s."
+          " Map operation was ignored.", port_name, system_port);
+      } else {
+        TTCN_warning("Port %s is already mapped to system:%s."
+          " Map operation was ignored.", system_port, port_name);
+      }
       return;
     }
   }
-
-  set_system_parameters(system_port);
+  if (translation == FALSE) {
+    set_system_parameters(system_port);
+  } else {
+    set_system_parameters(port_name);
+  }
 
   user_map(system_port);
 
-  TTCN_Logger::log_port_misc(
-    TitanLoggerApi::Port__Misc_reason::port__was__mapped__to__system,
-    port_name, SYSTEM_COMPREF, system_port);
+  if (translation == FALSE) {
+    TTCN_Logger::log_port_misc(
+      TitanLoggerApi::Port__Misc_reason::port__was__mapped__to__system,
+      port_name, SYSTEM_COMPREF, system_port);
+  } else {
+    TTCN_Logger::log_port_misc(
+      TitanLoggerApi::Port__Misc_reason::port__was__mapped__to__system,
+      system_port, SYSTEM_COMPREF, port_name);
+  }
 
   // the mapping shall be registered in the table only if user_map() was
   // successful
@@ -2170,7 +2211,7 @@ void PORT::map(const char *system_port)
     "addressing.", port_name);
 }
 
-void PORT::unmap(const char *system_port)
+void PORT::unmap(const char *system_port, boolean translation)
 {
   int del_posn;
   for (del_posn = 0; del_posn < n_system_mappings; del_posn++) {
@@ -2182,8 +2223,13 @@ void PORT::unmap(const char *system_port)
     }
   }
   if (del_posn >= n_system_mappings) {
-    TTCN_warning("Port %s is not mapped to system:%s. "
-      "Unmap operation was ignored.", port_name, system_port);
+    if (translation == FALSE) {
+      TTCN_warning("Port %s is not mapped to system:%s. "
+        "Unmap operation was ignored.", port_name, system_port);
+    } else {
+      TTCN_warning("Porta %s is not mapped to system:%s. "
+        "Unmap operation was ignored.", system_port, port_name);
+    }
     return;
   }
 
@@ -2439,27 +2485,42 @@ void PORT::terminate_local_connection(const char *src_port,
   }
 }
 
-void PORT::map_port(const char *component_port, const char *system_port)
+void PORT::map_port(const char *component_port, const char *system_port, boolean translation)
 {
-  PORT *port_ptr = lookup_by_name(component_port);
+  const char *port_name = translation == FALSE ? component_port : system_port;
+  PORT *port_ptr = lookup_by_name(port_name, translation);
   if (port_ptr == NULL) TTCN_error("Map operation refers to "
-    "non-existent port %s.", component_port);
+    "non-existent port %s.", port_name);
   if (port_ptr->connection_list_head != NULL) {
-    TTCN_error("Map operation is not allowed on a connected port (%s).", component_port);
+    TTCN_error("Map operation is not allowed on a connected port (%s).", port_name);
+  }
+  if (translation == FALSE) {
+    port_ptr->map(system_port, translation);
+  } else {
+    port_ptr->map(component_port, translation);
+  }
+  if (!TTCN_Runtime::is_single()) {
+    if (translation == FALSE) {
+      TTCN_Communication::send_mapped(component_port, system_port, translation);
+    } else {
+      TTCN_Communication::send_mapped(system_port, component_port, translation);
+    }
   }
-  port_ptr->map(system_port);
-  if (!TTCN_Runtime::is_single())
-    TTCN_Communication::send_mapped(component_port, system_port);
 }
 
-void PORT::unmap_port(const char *component_port, const char *system_port)
+void PORT::unmap_port(const char *component_port, const char *system_port, boolean translation)
 {
-  PORT *port_ptr = lookup_by_name(component_port);
+  const char *port_name = translation == FALSE ? component_port : system_port;
+  PORT *port_ptr = lookup_by_name(port_name, translation);
   if (port_ptr == NULL) TTCN_error("Unmap operation refers to "
-    "non-existent port %s.", component_port);
-  port_ptr->unmap(system_port);
+    "non-existent port %s.", port_name);
+  if (translation == FALSE) {
+    port_ptr->unmap(system_port, translation);
+  } else {
+    port_ptr->unmap(component_port, translation);
+  }
   if (!TTCN_Runtime::is_single())
-    TTCN_Communication::send_unmapped(component_port, system_port);
+    TTCN_Communication::send_unmapped(component_port, system_port, translation);
 }
 
 boolean PORT::check_port_state(const CHARSTRING& type) const
@@ -2489,6 +2550,12 @@ boolean PORT::any_check_port_state(const CHARSTRING& type)
       return TRUE;
     }
   }
+  for (PORT *port = system_list_head; port != NULL; port = port->list_next) {
+    result = port->check_port_state(type);
+    if (result) {
+      return TRUE;
+    }
+  }
   return FALSE;
 }
 
@@ -2498,5 +2565,8 @@ boolean PORT::all_check_port_state(const CHARSTRING& type)
   for (PORT *port = list_head; port != NULL && result; port = port->list_next) {
     result = port->check_port_state(type);
   }
+  for (PORT *port = system_list_head; port != NULL && result; port = port->list_next) {
+    result = port->check_port_state(type);
+  }
   return result;
 }
diff --git a/core/Port.hh b/core/Port.hh
index e89b72fcec916d07520fd0e5314ef160bcd2f7bf..ee925b46eb3ef1c02919c4437e29abcd13b1c4f3 100644
--- a/core/Port.hh
+++ b/core/Port.hh
@@ -44,10 +44,16 @@ class PORT : public Fd_And_Timeout_Event_Handler {
   friend struct port_connection;
 
   static PORT *list_head, *list_tail;
+  
+  // Used during translation port activate. It will
+  // contains the provider ports. It is needed because the
+  // names of the ports of system component and the mtc
+  // can be the same.
+  static PORT *system_list_head, *system_list_tail;
 
-  void add_to_list();
-  void remove_from_list();
-  static PORT *lookup_by_name(const char *par_port_name);
+  void add_to_list(boolean system = FALSE);
+  void remove_from_list(boolean system);
+  static PORT *lookup_by_name(const char *par_port_name, boolean system = FALSE);
 
   struct port_parameter; // no user serviceable parts inside
   static port_parameter *parameter_head, *parameter_tail;
@@ -117,8 +123,8 @@ public:
 
   virtual void log() const;
 
-  void activate_port();
-  void deactivate_port();
+  void activate_port(boolean system = FALSE);
+  void deactivate_port(boolean system);
   static void deactivate_all();
 
   void clear();
@@ -130,6 +136,8 @@ public:
   void halt();
   static void all_halt();
   
+  boolean port_is_started();
+  
   boolean check_port_state(const CHARSTRING& type) const;
   static boolean any_check_port_state(const CHARSTRING& type);
   static boolean all_check_port_state(const CHARSTRING& type);
@@ -341,8 +349,8 @@ private:
   void handle_incoming_data(port_connection *conn_ptr);
   void process_last_message(port_connection *conn_ptr);
 
-  void map(const char *system_port);
-  void unmap(const char *system_port);
+  void map(const char *system_port, boolean translation);
+  void unmap(const char *system_port, boolean translation);
 
 public:
   static void process_connect_listen(const char *local_port,
@@ -358,8 +366,8 @@ public:
   static void terminate_local_connection(const char *src_port,
     const char *dest_port);
 
-  static void map_port(const char *component_port, const char *system_port);
-  static void unmap_port(const char *component_port, const char *system_port);
+  static void map_port(const char *component_port, const char *system_port, boolean translation);
+  static void unmap_port(const char *component_port, const char *system_port, boolean translation);
 };
 
 #endif
diff --git a/core/Runtime.cc b/core/Runtime.cc
index 67eee909ef904d3a79f39fee6a3257b4ea7da9b2..e08453d6a280a8bd5f01caa84a3e6882aaec52d7 100644
--- a/core/Runtime.cc
+++ b/core/Runtime.cc
@@ -1801,7 +1801,7 @@ void TTCN_Runtime::disconnect_port(
 
 void TTCN_Runtime::map_port(
   const COMPONENT& src_compref, const char *src_port,
-  const COMPONENT& dst_compref, const char *dst_port)
+  const COMPONENT& dst_compref, const char *dst_port, boolean translation)
 {
   check_port_name(src_port, "map", "first");
   check_port_name(dst_port, "map", "second");
@@ -1849,17 +1849,17 @@ void TTCN_Runtime::map_port(
   case SINGLE_TESTCASE:
     if (comp_reference != MTC_COMPREF) TTCN_error("Only the ports of mtc "
       "can be mapped in single mode.");
-    PORT::map_port(comp_port, system_port);
+    PORT::map_port(comp_port, system_port, translation);
     break;
   case MTC_TESTCASE:
     TTCN_Communication::send_map_req(comp_reference, comp_port,
-      system_port);
+      system_port, translation);
     executor_state = MTC_MAP;
     wait_for_state_change();
     break;
   case PTC_FUNCTION:
     TTCN_Communication::send_map_req(comp_reference, comp_port,
-      system_port);
+      system_port, translation);
     executor_state = PTC_MAP;
     wait_for_state_change();
     break;
@@ -1879,7 +1879,7 @@ void TTCN_Runtime::map_port(
 
 void TTCN_Runtime::unmap_port(
   const COMPONENT& src_compref, const char *src_port,
-  const COMPONENT& dst_compref, const char *dst_port)
+  const COMPONENT& dst_compref, const char *dst_port, boolean translation)
 {
   check_port_name(src_port, "unmap", "first");
   check_port_name(dst_port, "unmap", "second");
@@ -1927,17 +1927,17 @@ void TTCN_Runtime::unmap_port(
   case SINGLE_TESTCASE:
     if (comp_reference != MTC_COMPREF) TTCN_error("Only the ports of mtc "
       "can be unmapped in single mode.");
-    PORT::unmap_port(comp_port, system_port);
+    PORT::unmap_port(comp_port, system_port, translation);
     break;
   case MTC_TESTCASE:
     TTCN_Communication::send_unmap_req(comp_reference, comp_port,
-      system_port);
+      system_port, translation);
     executor_state = MTC_UNMAP;
     wait_for_state_change();
     break;
   case PTC_FUNCTION:
     TTCN_Communication::send_unmap_req(comp_reference, comp_port,
-      system_port);
+      system_port, translation);
     executor_state = PTC_UNMAP;
     wait_for_state_change();
     break;
diff --git a/core/Runtime.hh b/core/Runtime.hh
index 798f2e8e6c19e7977bfa92ce2c5a1c4cf2aad3df..d0e6660d609d0dca8201f919c41814e505f861c4 100644
--- a/core/Runtime.hh
+++ b/core/Runtime.hh
@@ -254,10 +254,10 @@ public:
     const COMPONENT& dst_compref, const char *dst_port);
   static void map_port(
     const COMPONENT& src_compref, const char *src_port,
-    const COMPONENT& dst_compref, const char *dst_port);
+    const COMPONENT& dst_compref, const char *dst_port, boolean translation = FALSE);
   static void unmap_port(
     const COMPONENT& src_compref, const char *src_port,
-    const COMPONENT& dst_compref, const char *dst_port);
+    const COMPONENT& dst_compref, const char *dst_port, boolean translation = FALSE);
 
   static void begin_controlpart(const char *module_name);
   static void end_controlpart();
diff --git a/mctr2/mctr/MainController.cc b/mctr2/mctr/MainController.cc
index 20abf337603f6adbf378534cfffac355be1b1238..336944d6ffc5cd43d752604303be0273b4955272 100644
--- a/mctr2/mctr/MainController.cc
+++ b/mctr2/mctr/MainController.cc
@@ -3381,10 +3381,11 @@ void MainController::send_disconnect_ack(component_struct *tc)
 }
 
 void MainController::send_map(component_struct *tc,
-  const char *local_port, const char *system_port)
+  const char *local_port, const char *system_port, boolean translation)
 {
   Text_Buf text_buf;
   text_buf.push_int(MSG_MAP);
+  text_buf.push_int(translation == FALSE ? 0 : 1);
   text_buf.push_string(local_port);
   text_buf.push_string(system_port);
   send_message(tc->tc_fd, text_buf);
@@ -3398,10 +3399,11 @@ void MainController::send_map_ack(component_struct *tc)
 }
 
 void MainController::send_unmap(component_struct *tc,
-  const char *local_port, const char *system_port)
+  const char *local_port, const char *system_port, boolean translation)
 {
   Text_Buf text_buf;
   text_buf.push_int(MSG_UNMAP);
+  text_buf.push_int(translation == FALSE ? 0 : 1);
   text_buf.push_string(local_port);
   text_buf.push_string(system_port);
   send_message(tc->tc_fd, text_buf);
@@ -5325,6 +5327,7 @@ void MainController::process_map_req(component_struct *tc)
 
   Text_Buf& text_buf = *tc->text_buf;
   component src_compref = text_buf.pull_int().get_val();
+  int_val_t translate = text_buf.pull_int();
   char *src_port = text_buf.pull_string();
   char *system_port = text_buf.pull_string();
 
@@ -5337,7 +5340,7 @@ void MainController::process_map_req(component_struct *tc)
   port_connection *conn = find_connection(src_compref, src_port,
     SYSTEM_COMPREF, system_port);
   if (conn == NULL) {
-    send_map(components[src_compref], src_port, system_port);
+    send_map(components[src_compref], src_port, system_port, translate == 0 ? FALSE : TRUE);
     conn = new port_connection;
     conn->head.comp_ref = src_compref;
     conn->head.port_name = src_port;
@@ -5378,16 +5381,23 @@ void MainController::process_mapped(component_struct *tc)
 
   Text_Buf& text_buf = *tc->text_buf;
   component src_compref = tc->comp_ref;
+  boolean translation = text_buf.pull_int().get_val() == 0 ? FALSE : TRUE;
   char *src_port = text_buf.pull_string();
   char *system_port = text_buf.pull_string();
 
-  port_connection *conn = find_connection(src_compref, src_port,
-    SYSTEM_COMPREF, system_port);
+  port_connection *conn = NULL;
+  if (translation == FALSE) { 
+    conn = find_connection(src_compref, src_port,
+      SYSTEM_COMPREF, system_port);
+  } else {
+    conn = find_connection(SYSTEM_COMPREF, src_port,
+      src_compref, system_port);
+  }
   if (conn == NULL) {
     send_error(tc->tc_fd, "The MAPPED message refers to a "
       "non-existent port mapping %d:%s - system:%s.",
       src_compref, src_port, system_port);
-  } else if (conn->conn_state != CONN_MAPPING) {
+  } else if (conn->conn_state != CONN_MAPPING && conn->conn_state != CONN_MAPPED && translation == TRUE) {
     send_error(tc->tc_fd, "Unexpected MAPPED message was "
       "received for port mapping %d:%s - system:%s.",
       src_compref, src_port, system_port);
@@ -5416,23 +5426,32 @@ void MainController::process_unmap_req(component_struct *tc)
 
   Text_Buf& text_buf = *tc->text_buf;
   component src_compref = text_buf.pull_int().get_val();
+  boolean translation = text_buf.pull_int().get_val() == 0 ? FALSE : TRUE;
   char *src_port = text_buf.pull_string();
   char *system_port = text_buf.pull_string();
-
+  
   if (!valid_endpoint(src_compref, FALSE, tc, "unmap")) {
     delete [] src_port;
     delete [] system_port;
     return;
   }
-
-  port_connection *conn = find_connection(src_compref, src_port,
-    SYSTEM_COMPREF, system_port);
+  port_connection *conn = NULL;
+  if (translation == FALSE) { 
+    conn = find_connection(src_compref, src_port,
+      SYSTEM_COMPREF, system_port);
+  } else {
+    conn = find_connection(SYSTEM_COMPREF, src_port,
+      src_compref, system_port);
+  }
   if (conn == NULL) {
     send_unmap_ack(tc);
+    if (translation == TRUE) {
+      send_unmap(components[src_compref], src_port, system_port, TRUE);
+    }
   } else {
     switch (conn->conn_state) {
     case CONN_MAPPED:
-      send_unmap(components[src_compref], src_port, system_port);
+      send_unmap(components[src_compref], src_port, system_port, translation);
       conn->conn_state = CONN_UNMAPPING;
     case CONN_UNMAPPING:
       add_requestor(&conn->requestors, tc);
@@ -5460,11 +5479,18 @@ void MainController::process_unmapped(component_struct *tc)
 
   Text_Buf& text_buf = *tc->text_buf;
   component src_compref = tc->comp_ref;
+  boolean translation = text_buf.pull_int().get_val() == 0 ? FALSE : TRUE;
   char *src_port = text_buf.pull_string();
   char *system_port = text_buf.pull_string();
 
-  port_connection *conn = find_connection(src_compref, src_port,
-    SYSTEM_COMPREF, system_port);
+  port_connection *conn = NULL;
+  if (translation == FALSE) { 
+    conn = find_connection(src_compref, src_port,
+      SYSTEM_COMPREF, system_port);
+  } else {
+    conn = find_connection(SYSTEM_COMPREF, src_port,
+      src_compref, system_port);
+  }
   if (conn != NULL) {
     switch (conn->conn_state) {
     case CONN_MAPPING:
diff --git a/mctr2/mctr/MainController.h b/mctr2/mctr/MainController.h
index 39afdbc648f17b64e31a1a33ea850d5e36eb8b1a..abfcb5a8073654d5f6e736fe8707a919bcb7e2d6 100644
--- a/mctr2/mctr/MainController.h
+++ b/mctr2/mctr/MainController.h
@@ -523,10 +523,10 @@ private:
     const char *local_port, component remote_comp, const char *remote_port);
   static void send_disconnect_ack(component_struct *tc);
   static void send_map(component_struct *tc,
-    const char *local_port, const char *system_port);
+    const char *local_port, const char *system_port, boolean translate);
   static void send_map_ack(component_struct *tc);
   static void send_unmap(component_struct *tc,
-    const char *local_port, const char *system_port);
+    const char *local_port, const char *system_port, boolean translate);
   static void send_unmap_ack(component_struct *tc);
   static void send_debug_command(int fd, int commandID, const char* arguments);
   static void send_debug_setup(host_struct *hc);
diff --git a/regression_test/portTranslation/P1.cc b/regression_test/portTranslation/P1.cc
index d5644e0b4836c0923af3726bdb0da45bcc99607e..4e96acded9734f3c78ed703560decd7cb6a629fe 100644
--- a/regression_test/portTranslation/P1.cc
+++ b/regression_test/portTranslation/P1.cc
@@ -18,7 +18,9 @@ namespace PortTranslation {
 P1_PROVIDER::P1_PROVIDER(const char *par_port_name)
 	: PORT(par_port_name)
 {
-
+	user_start_ran = FALSE;
+	user_map_ran = 0;
+	port_param_set = FALSE;
 }
 
 P1_PROVIDER::~P1_PROVIDER()
@@ -26,10 +28,12 @@ P1_PROVIDER::~P1_PROVIDER()
 
 }
 
-void P1_PROVIDER::set_parameter(const char * /*parameter_name*/,
-	const char * /*parameter_value*/)
+void P1_PROVIDER::set_parameter(const char * parameter_name,
+	const char * parameter_value)
 {
-
+	if (strcmp(parameter_name, "test_param") == 0) {
+		port_param_set = TRUE;
+	}
 }
 
 /*void P1_PROVIDER::Handle_Fd_Event(int fd, boolean is_readable,
@@ -54,38 +58,69 @@ void P1_PROVIDER::Handle_Fd_Event_Readable(int /*fd*/)
 
 void P1_PROVIDER::user_map(const char * /*system_port*/)
 {
-
+	if (user_start_ran == FALSE) {
+		TTCN_error("user_start did not ran in P1");
+	}
+	if (port_param_set == FALSE) {
+		TTCN_error("Port parameter is not set in P1");
+	}
+	user_map_ran++;
 }
 
 void P1_PROVIDER::user_unmap(const char * /*system_port*/)
 {
-
+	if (user_start_ran == FALSE) {
+		TTCN_error("user_start did not ran in P1");
+	}
+	user_map_ran--;
+	port_param_set = FALSE;
 }
 
 void P1_PROVIDER::user_start()
 {
-
+	if (user_start_ran == TRUE) {
+		TTCN_error("user_start already ran in P1");
+	}
+	user_start_ran = TRUE;
 }
 
 void P1_PROVIDER::user_stop()
 {
-
+	if (user_start_ran == FALSE) {
+		TTCN_error("user_start did not ran in P1");
+	}
+	user_start_ran = FALSE;
 }
 
 void P1_PROVIDER::outgoing_send(const MyRec& send_par)
 {
+	if (user_start_ran == FALSE) {
+		TTCN_error("user_start did not ran in P1");
+	}
 	OCTETSTRING os = send_par.val();
 	incoming_message(os);
 }
 
 void P1_PROVIDER::outgoing_send(const OCTETSTRING& send_par)
 {
+	if (user_start_ran == FALSE) {
+		TTCN_error("user_start did not ran in P1");
+	}
+	if (user_map_ran <= 0) {
+		TTCN_error("user_map did not ran in P1");
+	}
 	INTEGER integer = send_par.lengthof();
 	incoming_message(integer);
 }
 
 void P1_PROVIDER::outgoing_send(const BITSTRING& send_par)
 {
+	if (user_start_ran == FALSE) {
+		TTCN_error("user_start did not ran in P1");
+	}
+	if (user_map_ran <= 0) {
+		TTCN_error("user_map did not ran in P1");
+	}
 	// Test that the receive mapping handles fragmented case
 	if (send_par.lengthof() == 48) {
 		for (int i = 0; i < 48; i++) {
@@ -99,16 +134,34 @@ void P1_PROVIDER::outgoing_send(const BITSTRING& send_par)
 
 void P1_PROVIDER::outgoing_send(const CHARSTRING& send_par)
 {
+	if (user_start_ran == FALSE) {
+		TTCN_error("user_start did not ran in P1");
+	}
+	if (user_map_ran <= 0) {
+		TTCN_error("user_map did not ran in P1");
+	}
 	incoming_message(send_par);
 }
 
 void P1_PROVIDER::outgoing_send(const INTEGER& send_par)
 {
+	if (user_start_ran == FALSE) {
+		TTCN_error("user_start did not ran in P1");
+	}
+	if (user_map_ran <= 0) {
+		TTCN_error("user_map did not ran in P1");
+	}
 	incoming_message(send_par);
 }
 
 void P1_PROVIDER::outgoing_send(const HEXSTRING& send_par)
 {
+	if (user_start_ran == FALSE) {
+		TTCN_error("user_start did not ran in P1");
+	}
+	if (user_map_ran <= 0) {
+		TTCN_error("user_map did not ran in P1");
+	}
 	incoming_message(send_par);
 }
 
diff --git a/regression_test/portTranslation/P1.hh b/regression_test/portTranslation/P1.hh
index b8a430793d15961eaaeda0d90dbf77d8e10188f2..ddba114e0e00a59a30ac6208446dc89d64b0f34b 100644
--- a/regression_test/portTranslation/P1.hh
+++ b/regression_test/portTranslation/P1.hh
@@ -38,6 +38,10 @@ private:
 	void Handle_Fd_Event_Writable(int fd);
 	void Handle_Fd_Event_Readable(int fd);
 	/* void Handle_Timeout(double time_since_last_call); */
+
+	int user_map_ran;
+	boolean user_start_ran;
+	boolean port_param_set;
 protected:
 	void user_map(const char *system_port);
 	void user_unmap(const char *system_port);
diff --git a/regression_test/portTranslation/PortTranslation.ttcn b/regression_test/portTranslation/PortTranslation.ttcn
index 5a9c0ef894d728a0e8fec49a20ce5f371ce94c50..ad8db749bf631da956ac3b920f4eda3d64b9b1c6 100644
--- a/regression_test/portTranslation/PortTranslation.ttcn
+++ b/regression_test/portTranslation/PortTranslation.ttcn
@@ -254,6 +254,11 @@ module PortTranslation {
 
 	type component MyComp {
 		port PT2 p;
+
+		// Extra port types to check if multiple map/unmaps does not make things go bad
+		port PT2 p11;
+		port PT2 p12;
+		port PT2 p13;
 	}
 
 	type component System {
@@ -261,13 +266,56 @@ module PortTranslation {
 		port P2 p2
 		port P3 p3
 
+		// Extra port types to check if multiple map/unmaps does not make things go bad
+		port P1 p11
+		port P1 p12
+		port P1 p13
+		port P1 p14
 	}
 
 ///////////////////////////////////////////////////////////////////////////////
 
 
 	testcase tc_send() runs on MyComp system System {
+
+
+		// Several maps/unmaps but in the end only self:p and system:p1 will be mapped
 		map(self:p, system:p1);
+		map(self:p, system:p11);
+		map(self:p11, system:p1);
+		map(self:p, system:p11);
+		map(self:p, system:p12);
+		map(self:p, system:p13);
+		map(self:p, system:p14);
+		map(self:p, system:p13);
+		map(self:p, system:p12);
+		map(self:p, system:p11);
+
+		unmap(self:p, system:p11);
+		unmap(self:p, system:p11);
+		unmap(self:p11, system:p1);
+		unmap(self:p, system:p12);
+		unmap(self:p, system:p13);
+		unmap(self:p, system:p14);
+		unmap(self:p, system:p13);
+		unmap(self:p, system:p12);
+		unmap(self:p, system:p11);
+
+
+		map(self:p, system:p11);
+		map(self:p11, system:p1);
+		map(self:p11, system:p11);
+		map(self:p12, system:p11);
+		map(self:p13, system:p12);
+		map(self:p13, system:p12);
+
+		unmap(self:p, system:p11);
+		unmap(self:p11, system:p1);
+		unmap(self:p11, system:p11);
+		unmap(self:p12, system:p11);
+		unmap(self:p13, system:p12);
+		unmap(self:p13, system:p12);
+
 		var MyRec v_rec := { 'ABCDEF'O, Oct };
 
 		// Send octetstring with Oct, so the first mapping function will be successful
@@ -310,6 +358,7 @@ module PortTranslation {
 		v_rec := { '123456'O, None };
 		@try{
 			p.send(v_rec);
+			setverdict(fail, "DTE was expected");
 		} @catch (e) {
 			if (match(e, "Dynamic test case error: Outgoing message of type @PortTranslation.MyRec could not be handled by the type mapping rules on port p.")) {
 				setverdict(pass);
@@ -343,6 +392,25 @@ module PortTranslation {
 		t.stop;
 
 		unmap(self:p, system:p1);
+
+		// Map a lot of things to check if the next testcase runs independently
+
+		map(self:p, system:p1);
+		map(self:p, system:p11);
+		map(self:p, system:p11);
+		map(self:p, system:p12);
+		map(self:p, system:p13);
+		map(self:p, system:p14);
+		map(self:p, system:p13);
+		map(self:p, system:p12);
+		map(self:p, system:p11);
+
+		map(self:p, system:p11);
+		map(self:p11, system:p1);
+		map(self:p11, system:p11);
+		map(self:p12, system:p11);
+		map(self:p13, system:p12);
+		map(self:p13, system:p12);
 	}
 
 ///////////////////////////////////////////////////////////////////////////////
diff --git a/regression_test/portTranslation/config.cfg b/regression_test/portTranslation/config.cfg
index 367d96b9f8eb68dc1587d091b8d7e4c0d8a0f638..4d42b778cbb8e8487bc838e4f5f44fa4284ba491 100644
--- a/regression_test/portTranslation/config.cfg
+++ b/regression_test/portTranslation/config.cfg
@@ -12,4 +12,11 @@
 [EXECUTE]
 PortTranslation.control
 Setstate_neg.control
-PortVariables.control
\ No newline at end of file
+PortVariables.control
+
+[TESTPORT_PARAMETERS]
+system.p1.test_param:="66"
+system.p11.test_param:="66"
+system.p12.test_param:="66"
+system.p13.test_param:="66"
+system.p14.test_param:="66"
\ No newline at end of file