diff --git a/compiler2/ttcn3/port.c b/compiler2/ttcn3/port.c
index 7eb70bce26d53ae3015bc62547c8fc86b8fb3f37..d2b98bedec38d73703f1201bdc550be3040b9123 100644
--- a/compiler2/ttcn3/port.c
+++ b/compiler2/ttcn3/port.c
@@ -2112,9 +2112,29 @@ void defPortClass(const port_def* pdef, output_struct* output)
       "}\n\n", class_name, sig->name);
   }
 
+  if (pdef->port_type == USER) {
+    def = mputstr(def, "public:\n");
+    def = mputstr(def, "PORT* get_provider_port();");
+    src = mputprintf(src,
+      "PORT* %s::get_provider_port() {\n"
+      "(void)get_default_destination();\n", class_name);
+    if (pdef->legacy) {
+      src = mputstr(src, "return this;\n");
+    } else {
+      for (i = 0; i < pdef->provider_msg_outlist.nElements; i++) {
+        src = mputprintf(src,
+          "for (size_t i = 0; i < n_%i; i++) {\n"
+          "if (p_%i[i] != NULL) {\n"
+          "return p_%i[i];\n"
+          "}\n"
+          "}\n", (int)i, (int)i, (int)i);
+      }
+      src = mputstr(src, "return NULL;\n");
+    }
+    src = mputstr(src, "}\n\n");
+  }
     
   if (pdef->port_type == USER && !pdef->legacy) {
-    def = mputstr(def, "public:\n");
     // 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);
@@ -2170,7 +2190,7 @@ void defPortClass(const port_def* pdef, output_struct* output)
       "void %s::change_port_state(translation_port_state state) {\n"
       "port_state = state;\n"
       "}\n\n", class_name);
-    
+        
     def = mputstr(def, "private:\n");
     // Resets all port type variables to NULL
     def = mputstr(def, "void reset_port_variables();\n");
diff --git a/core/Port.cc b/core/Port.cc
index 276ac6c870d4d30e0b13e56315fff328818c5380..0028933647ef771c921627211d81f073fd232a2f 100644
--- a/core/Port.cc
+++ b/core/Port.cc
@@ -504,12 +504,7 @@ boolean PORT::port_is_started() {
 }
 
 PORT* PORT::get_provider_port() {
-  get_default_destination();
-  PORT* p = lookup_by_name(system_mappings[0], TRUE);
-  if (p == NULL) {
-    p = lookup_by_name(system_mappings[0], FALSE);
-  }
-  return p;
+  return NULL;
 }
 
 alt_status PORT::receive(const COMPONENT_template&, COMPONENT *, Index_Redirect*)
diff --git a/core/Port.hh b/core/Port.hh
index b7dd4605c2d6c212ea534606b59718dfd73b6458..115a6cf20b2e90de5c92015e9001d4bfc97f606b 100644
--- a/core/Port.hh
+++ b/core/Port.hh
@@ -139,10 +139,15 @@ public:
   boolean port_is_started();
   
   // Returns the outer message port it is mapped to 
-  // when the port works in translation mode. Otherwise returns NULL.
+  // when the port works in translation mode. 
+  // In the case of dual faced ports it returns the port object
+  // it is called on (this).
+  // Otherwise returns NULL.
   // Emits errors when the port is mapped to more than one port or
-  // has both connections or mappings.
-  PORT* get_provider_port();
+  // has both connections and mappings.
+  // This function is overridden only in the class of a port with translation
+  // capability and dual faced ports.
+  virtual PORT* get_provider_port();
   
   boolean check_port_state(const CHARSTRING& type) const;
   static boolean any_check_port_state(const CHARSTRING& type);