diff --git a/compiler2/Type_chk.cc b/compiler2/Type_chk.cc
index 0bad3de588170cb3ed9ac552f680eab2c8c4bd79..5b7c9ee32ffaea848eaeb38c778a8901f5ea003f 100644
--- a/compiler2/Type_chk.cc
+++ b/compiler2/Type_chk.cc
@@ -3084,14 +3084,8 @@ void Type::chk_oer() {
       if (t->get_sub_type()) {
         oerattrib->extendable = t->get_sub_type()->is_extendable();
       }
-      for (size_t i = 0; i < t->get_nof_comps(); i++) {
-        t->get_comp_byIndex(i)->get_type()->chk();
-      }
       break; }
-    case T_SEQOF: {
-      t->get_ofType()->chk();
-      break;
-    }
+    case T_SEQOF:
     case T_BOOL:
     case T_ENUM_A:
     case T_UTF8STRING:
diff --git a/compiler2/record.c b/compiler2/record.c
index d15ddc1002aea46190e1df7969c9886031a0e9f4..11f21314c1553cf6a696af0c431e51ee238fef2f 100644
--- a/compiler2/record.c
+++ b/compiler2/record.c
@@ -4746,7 +4746,7 @@ void defRecordClass1(const struct_def *sdef, output_struct *output)
           , sdef->elements[i].typedescrname);
       }
     }
-    if (sdef->has_opentypes) {
+    if (sdef->opentype_outermost) {
       src = mputstr(src,
         "  TTCN_EncDec_ErrorContext ec_1(\"While decoding opentypes: \");"
         "  TTCN_Type_list p_typelist;\n"
diff --git a/compiler2/record_of.c b/compiler2/record_of.c
index ef490901aab14ad0757dde353be68906d1cd6fa7..561784f0cea3319f09eecc2840f013bc5eb2211e 100644
--- a/compiler2/record_of.c
+++ b/compiler2/record_of.c
@@ -1680,9 +1680,9 @@ void defRecordOfClass1(const struct_of_def *sdef, output_struct *output)
          "  p_typelist.push(this);\n"
          "  TTCN_EncDec_ErrorContext ec_0(\"Component #\");\n"
          "  TTCN_EncDec_ErrorContext ec_1;\n"
-         "  for(int elem_i=0; elem_i<n_elements; elem_i++) {\n"
+         "  for(int elem_i=0; elem_i<val_ptr->n_elements; elem_i++) {\n"
          "    ec_1.set_msg(\"%%d: \", elem_i);\n"
-         "    value_elements[elem_i].OER_decode_opentypes(p_typelist,"
+         "    (*this)[elem_i].OER_decode_opentypes(p_typelist,"
          " p_buf, p_oer);\n"
          "  }\n"
          "  p_typelist.pop();\n"
diff --git a/core/Basetype.hh b/core/Basetype.hh
index 204027954bbe4d7163e3de87d4aee098987fd0be..cf22a7ef543cd5d1a596160ede269a2974a21616 100644
--- a/core/Basetype.hh
+++ b/core/Basetype.hh
@@ -397,7 +397,7 @@ public:
   virtual int encode_raw(TTCN_Buffer& p_buf) const;
   virtual int RAW_encode_negtest_raw(RAW_enc_tree& p_myleaf) const;
   virtual int JSON_encode_negtest_raw(JSON_Tokenizer&) const;
-  virtual int OER_encode_negtest_raw(JSON_Tokenizer&) const; //TODO
+  virtual int OER_encode_negtest_raw(TTCN_Buffer&) const; //TODO
 #endif
 
   /** Examines whether this message corresponds the tags in the
diff --git a/core/OER.cc b/core/OER.cc
index 927ef94c56ffbc7757ba68152ab3f99b8bc7191b..009f71853aa5e0d7ef8f754ff139eed557680eed 100644
--- a/core/OER.cc
+++ b/core/OER.cc
@@ -22,7 +22,7 @@ void encode_oer_length(size_t num_bytes, TTCN_Buffer& buf, boolean seof) {
     buf.put_c(num_bytes);
   } else {
     size_t bytes = num_bytes;
-    // Encode length in maybe more than 1 bytes
+    // Encode length in maybe more than 1 byte
     size_t needed_bytes = 0;
     while (bytes != 0) {
       bytes >>= 8;
diff --git a/core2/Basetype2.cc b/core2/Basetype2.cc
index 47d760eeb4001a50b68616d7d095c2d24ef5f576..ad9641990f24887bd4ca8f24d1aa9b11960d4f7a 100644
--- a/core2/Basetype2.cc
+++ b/core2/Basetype2.cc
@@ -197,7 +197,7 @@ int Base_Type::JSON_encode_negtest_raw(JSON_Tokenizer&) const
   return 0;
 }
 
-int Base_Type::OER_encode_negtest_raw(JSON_Tokenizer&) const
+int Base_Type::OER_encode_negtest_raw(TTCN_Buffer&) const
 {
   TTCN_error("A value of type %s cannot be used as erroneous raw value for OER encoding.",
              get_descriptor()->name);
diff --git a/regression_test/OER/OER.ttcn b/regression_test/OER/OER.ttcn
index f8b4c8b383edc8fab849c687c0b4a2b971250887..94be9cbf6abd82f9c5b44834c7a4122402786a50 100644
--- a/regression_test/OER/OER.ttcn
+++ b/regression_test/OER/OER.ttcn
@@ -2753,6 +2753,12 @@
      with { extension "prototype (convert) encode(OER)" }
   
     external function dec_Item(in octetstring stream) return Item
+     with { extension "prototype (convert) decode(OER)" }
+
+    external function enc_ErrorReturn(in ErrorReturn pdu) return octetstring
+     with { extension "prototype (convert) encode(OER)" }
+  
+    external function dec_ErrorReturn(in octetstring stream) return ErrorReturn
      with { extension "prototype (convert) decode(OER)" }
 
  	testcase tc_opentype() runs on EmptyCT {
@@ -2775,6 +2781,33 @@
  			setverdict(fail, "tc_opentype: ", match(pf, pfres));
  		}
 
+
+ 		var ErrorReturn er, erres;
+
+ 		er := {
+ 			errorCategory := "A",
+ 			errors := {
+ 				{
+ 					errorCode := 1,
+ 					errorInfo := {errorSet_1_Type := 365}
+ 				},
+ 				{
+ 					errorCode := 2,
+ 					errorInfo := {errorSet_2_Type := "If U can decode this, U can be happy. Smile! :-)"}
+ 				}
+ 			}
+ 		}
+
+ 		os := enc_ErrorReturn(er);
+ 		if (os != 'C041010201010302016D01023130496620552063616E206465636F646520746869732C20552063616E2062652068617070792E20536D696C6521203A2D29'O) {
+ 			setverdict(fail, "tc_opentype: ", match('C041010201010302016D01023130496620552063616E206465636F646520746869732C20552063616E2062652068617070792E20536D696C6521203A2D29'O, os));
+ 		}
+
+ 		erres := dec_ErrorReturn(os);
+ 		if (er != erres) {
+ 			setverdict(fail, "tc_opentype: ", match(er, erres));
+ 		}
+
  		setverdict(pass);
  	}
 
diff --git a/regression_test/OER/Types.asn b/regression_test/OER/Types.asn
index 21b63c4ce87ef9e0e4666c3bcb09b054294ccb37..e191a110fffc4169b3e0cef06e675c42b3156f73 100644
--- a/regression_test/OER/Types.asn
+++ b/regression_test/OER/Types.asn
@@ -371,4 +371,39 @@ dateOfBirth "19571111"},
 dateOfBirth "19590717"}}}
 
 
+
+ERROR-CLASS ::= CLASS
+{
+  &category	PrintableString(SIZE(1)),
+  &code		INTEGER,
+  &Type	DEFAULT INTEGER
+}
+WITH SYNTAX {&category &code [&Type]}
+
+ErrorSet ERROR-CLASS ::=
+{
+  {"A" 1 [1] INTEGER} |
+  {"A" 2 [1] VisibleString} |
+  {"B" 1 [1] PrintableString} |
+  {"B" 2 [1] BOOLEAN} |
+  oneErrorObject
+}
+
+oneErrorObject ERROR-CLASS ::= { "C" 3 ENUMERATED{foobar} }
+
+ErrorReturn ::= SEQUENCE
+{
+  errorCategory	ERROR-CLASS.&category ({ErrorSet}) OPTIONAL,
+  errors	SEQUENCE OF SEQUENCE
+  {
+    errorCode	ERROR-CLASS.&code({ErrorSet}{@errorCategory}),
+    errorInfo	[99] ERROR-CLASS.&Type({ErrorSet}{@errorCategory,@.errorCode})
+  } OPTIONAL
+}
+
+
+
+
+
+
 END
\ No newline at end of file