class field access problem

diff --git a/libasn1compiler/asn1c_misc.c b/libasn1compiler/asn1c_misc.c
index 779426a..8805347 100644
--- a/libasn1compiler/asn1c_misc.c
+++ b/libasn1compiler/asn1c_misc.c
@@ -131,6 +131,8 @@
 		while(top_parent->parent_expr)
 			top_parent = top_parent->parent_expr;
 
+	DEBUG("asn1c_type_name(%s: 0x%x)", expr->Identifier, expr->expr_type);
+
 	switch(expr->expr_type) {
 	case A1TC_REFERENCE:
 		typename = expr->reference->components[
@@ -144,7 +146,7 @@
 			 */
 			tmp.expr = asn1f_class_access_ex(arg->asn,
 				arg->expr->module, arg->expr, expr->reference);
-			if(tmp.expr) return NULL;
+			if(!tmp.expr) return NULL;
 
 			return asn1c_type_name(&tmp, tmp.expr, _format);
 		}