diff --git a/compiler2/ttcn3/port.c b/compiler2/ttcn3/port.c
index f024efd8acaa7ced718fb4a6653fb84390554a67..5808c9f2cb9597e83dc0911791662b20f5a797b7 100644
--- a/compiler2/ttcn3/port.c
+++ b/compiler2/ttcn3/port.c
@@ -200,10 +200,10 @@ static char *generate_send_mapping(char *src, const port_def *pdef,
     if (has_condition) {
       if (!pdef->legacy && pdef->port_type == USER) {
         src = mputstr(src, "if (port_state != PARTIALLY_TRANSLATED) {\n");
-      }
-      src = mputstr(src, "return;\n");
-      if (!pdef->legacy && pdef->port_type == USER) {
-        src = mputstr(src, "}\n");
+      	src = mputstr(src, "return;\n");
+      	src = mputstr(src, "}\n");
+      } else {
+      	src = mputstr(src, "return;\n");
       }
       if (pdef->legacy) {
         src = mputstr(src, "}\n");