diff --git a/regression_test/XML/XmlWorkflow/XmlTest_expectedTtcns/www_example_org_type_substitution_simpletype_e.ttcn b/regression_test/XML/XmlWorkflow/XmlTest_expectedTtcns/www_example_org_type_substitution_simpletype_e.ttcn
index e75c815a592563bce5f7370363c101e51c7d5a88..66fb3a58822b5c68f6dc688848b4fc33ce2b3ba6 100644
--- a/regression_test/XML/XmlWorkflow/XmlTest_expectedTtcns/www_example_org_type_substitution_simpletype_e.ttcn
+++ b/regression_test/XML/XmlWorkflow/XmlTest_expectedTtcns/www_example_org_type_substitution_simpletype_e.ttcn
@@ -1,7 +1,7 @@
-/******************************************************************************
+/*******************************************************************************
 * Copyright (c) 2000-2021 Ericsson Telecom AB
 *
-* XSD to TTCN-3 Translator
+* XSD to TTCN-3 Translator         
 *
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v2.0
@@ -11,15 +11,16 @@
 * Contributors:
 *   Balasko, Jeno
 *   Szabo, Bence Janos
+*   Botond, Baranyi
 *
-******************************************************************************/
+*******************************************************************************/
 //
 //  File:          www_example_org_type_substitution_simpletype.ttcn
 //  Description:
 //  References:
 //  Rev:
 //  Prodnr:
-//  Updated:       Wed Nov 18 11:56:35 2014
+//  Updated:       Mon Jan 18 18:05:14 2021
 //  Contact:       http://ttcn.ericsson.se
 //
 ////////////////////////////////////////////////////////////////////////////////
@@ -141,6 +142,28 @@ with {
 };
 
 
+/* Bug 569238 - xsd2ttcn creates cyclical definitions */
+
+
+type XSD.Token Head569238 (pattern "[0-9]#(6,15)");
+
+
+type Head569238 Type569238;
+
+
+type record Complex569238
+{
+	union {
+		Head569238_derivations head,
+		Type569238 type_
+	} choice
+}
+with {
+  variant (choice) "untagged";
+  variant (choice.type_) "name as 'type'";
+};
+
+
 type union String_derivations
 {
 	@default XSD.String string,
@@ -184,6 +207,18 @@ with {
 };
 
 
+type union Head569238_derivations
+{
+	@default Head569238 head569238,
+	Type569238 type569238
+}
+with {
+  variant "useType";
+  variant (head569238) "name as capitalized";
+  variant (type569238) "name as capitalized";
+};
+
+
 }
 with {
   encode "XML";
diff --git a/regression_test/XML/XmlWorkflow/xsd/type_substitution_simpletype.xsd b/regression_test/XML/XmlWorkflow/xsd/type_substitution_simpletype.xsd
index 5d8754363afac9f9dd3c2271373509aa1c2b24f7..2c14985f57ca4086601171dc2f0b6511e57e7154 100644
--- a/regression_test/XML/XmlWorkflow/xsd/type_substitution_simpletype.xsd
+++ b/regression_test/XML/XmlWorkflow/xsd/type_substitution_simpletype.xsd
@@ -59,5 +59,21 @@
 	</xsd:sequence>
 </xsd:complexType>
 
+<!-- Bug 569238 - xsd2ttcn creates cyclical definitions -->
+<xsd:simpleType name="Head569238">
+  <xsd:restriction base="xsd:token">
+    <xsd:pattern value="[0-9]{6,15}"/>
+  </xsd:restriction>
+</xsd:simpleType>
+<xsd:simpleType name="Type569238">
+  <xsd:restriction base="this:Head569238"/>
+</xsd:simpleType>
+<xsd:complexType name="Complex569238">
+  <xsd:choice>
+<xsd:element name="head" type="this:Head569238"/>
+<xsd:element name="type" type="this:Type569238"/>
+  </xsd:choice>
+</xsd:complexType>
+
 
 </xsd:schema>
diff --git a/xsdconvert/ComplexType.cc b/xsdconvert/ComplexType.cc
index 728fbd083e32de0f7b6fda60cc15ee0e2a570a85..07ebe316d9bd353971664aa76630bfc0aaac0ab5 100644
--- a/xsdconvert/ComplexType.cc
+++ b/xsdconvert/ComplexType.cc
@@ -862,7 +862,10 @@ void ComplexType::nameConversion_names(const List<NamespaceType> &) {
     addVariant(V_onlyValue, var);
   }
   for (List<RootType*>::iterator dep = nameDepList.begin(); dep; dep = dep->Next) {
-    dep->Data->setTypeValueWoPrefix(res);
+    SimpleType* dep_simple = typeSubsGroup == this ? dynamic_cast<SimpleType*>(dep->Data) : NULL;
+    if (dep_simple == NULL || dep_simple->parent != NULL || dep_simple->hasVariant(Mstring("\"element\""))) {
+      dep->Data->setTypeValueWoPrefix(res);
+    }
   }
 }