the Context ID is a 24bit number, we cannot use len = 4 bytes!
diff --git a/src/hnbgw_hnbap.c b/src/hnbgw_hnbap.c
index 25bc272..4896f34 100644
--- a/src/hnbgw_hnbap.c
+++ b/src/hnbgw_hnbap.c
@@ -70,6 +70,7 @@
 	OCTET_STRING_fromBuf(&accept.uE_Identity.choice.iMSI,
 			     (const char *)encoded_imsi, encoded_imsi_len);
 	asn1_u32_to_bitstring(&accept.context_ID, &ue->context_id);
+	accept.context_ID.size = 3;	/* 24bit field */
 
 	memset(&accept_out, 0, sizeof(accept_out));
 	rc = hnbap_encode_ueregisteraccepties(&accept_out, &accept);