fixed field lookup code

diff --git a/libasn1fix/asn1fix_class.c b/libasn1fix/asn1fix_class.c
index 98d47f4..05c3227 100644
--- a/libasn1fix/asn1fix_class.c
+++ b/libasn1fix/asn1fix_class.c
@@ -117,6 +117,9 @@
 
 static field_category_e
 asn1f_class_field_category(asn1p_expr_t *ofield) {
+
+	assert(ofield);
+
 	if(ofield->Identifier[0] != '&') {
 		assert(ofield->Identifier[0] == '&');
 		return OFC_INVALID;
@@ -194,10 +197,12 @@
 
 		ofield = asn1f_lookup_child(obj, comp_name);
 		if(ofield == NULL) {
-			DEBUG("Cannot find field \"%s\" in \"%s\" at line %d",
+			FATAL("Cannot find field \"%s\" in \"%s\" at line %d",
 				ref->components[1].name,
 				obj->Identifier,
 				obj->_lineno);
+			errno = EPERM;
+			return NULL;
 		}
 
 		/*