automatic dependency tracking

diff --git a/libasn1compiler/asn1c_misc.c b/libasn1compiler/asn1c_misc.c
index 7483a20..779426a 100644
--- a/libasn1compiler/asn1c_misc.c
+++ b/libasn1compiler/asn1c_misc.c
@@ -142,11 +142,10 @@
 			 * This is a reference to a type defined in a class.
 			 * Resolve it and use instead.
 			 */
-			tmp.expr = asn1f_class_access_ex(arg->asn, arg->mod,
-				arg->expr, expr->reference);
+			tmp.expr = asn1f_class_access_ex(arg->asn,
+				arg->expr->module, arg->expr, expr->reference);
 			if(tmp.expr) return NULL;
 
-			tmp.mod = tmp.expr->module;
 			return asn1c_type_name(&tmp, tmp.expr, _format);
 		}