diff --git a/asn1c/tests/check-126.-gen-PER.c b/asn1c/tests/check-126.-gen-PER.c
index 8217a64cebf3641dd0e25844b88e8e6810516eac..4d0775bfce3fd913f9f6423f11338e0e8e5444bf 100644
--- a/asn1c/tests/check-126.-gen-PER.c
+++ b/asn1c/tests/check-126.-gen-PER.c
@@ -238,14 +238,30 @@ compare_with_data_out(const char *fname, char *buf, int size) {
 
 	fprintf(stderr, "Comparing PER output with [%s]\n", outName);
 
-	if(strstr(outName, "-0-6-P.out")) {
+	if(strstr(outName, "-06-P.out")) {
+		f = fopen(outName, "w");
+		fbuf[0] = 0x81;
+		fbuf[1] = 0x40;
+		fbuf[2] = 0x00;
+		fwrite(fbuf, 1, 3, f);
+		fclose(f);
+	}
+
+	if(strstr(outName, "-07-P.out")) {
+		f = fopen(outName, "w");
+		fbuf[0] = 0x81;
+		fbuf[1] = 0x40;
+		fbuf[2] = 0x40;
+		fwrite(fbuf, 1, 3, f);
+		fclose(f);
+	}
+
+	if(strstr(outName, "-08-P.out")) {
 		f = fopen(outName, "w");
 		fbuf[0] = 0x81;
 		fbuf[1] = 0x40;
 		fbuf[2] = 0x80;
-		fbuf[3] = 0x00;
-		fbuf[4] = 0x00;
-		fwrite(fbuf, 1, 5, f);
+		fwrite(fbuf, 1, 3, f);
 		fclose(f);
 	}
 
diff --git a/skeletons/constr_SEQUENCE.c b/skeletons/constr_SEQUENCE.c
index 5d099ae98bb5050623bcd1f19b409fddef9a8c6c..ec04992f3d3625b2d61538856b631e8eef59f228 100644
--- a/skeletons/constr_SEQUENCE.c
+++ b/skeletons/constr_SEQUENCE.c
@@ -1249,6 +1249,7 @@ SEQUENCE_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
 	}
 
 	/* Prepare a place and read-in the presence bitmap */
+	memset(&opmd, 0, sizeof(opmd));
 	if(specs->roms_count) {
 		opres = (uint8_t *)MALLOC(((specs->roms_count + 7) >> 3) + 1);
 		if(!opres) _ASN_DECODE_FAILED;
@@ -1258,13 +1259,11 @@ SEQUENCE_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
 			_ASN_DECODE_STARVED;
 		}
 		opmd.buffer = opres;
-		opmd.nboff = 0;
 		opmd.nbits = specs->roms_count;
 		ASN_DEBUG("Read in presence bitmap for %s of %d bits (%x..)",
 			td->name, specs->roms_count, *opres);
 	} else {
 		opres = 0;
-		memset(&opmd, 0, sizeof opmd);
 	}
 
 	/*
@@ -1342,8 +1341,8 @@ SEQUENCE_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
 		if(per_get_many_bits(pd, epres, 0, bmlength))
 			_ASN_DECODE_STARVED;
 
+		memset(&epmd, 0, sizeof(epmd));
 		epmd.buffer = epres;
-		epmd.nboff = 0;
 		epmd.nbits = bmlength;
 		ASN_DEBUG("Read in extensions bitmap for %s of %d bits (%x..)",
 			td->name, bmlength, *epres);