diff -ruN klic-3.003-2002-03-05c/include/klic/g_basic.h klic-3.003-2002-03-05d/include/klic/g_basic.h
--- klic-3.003-2002-03-05c/include/klic/g_basic.h	Tue Mar  5 15:48:06 2002
+++ klic-3.003-2002-03-05d/include/klic/g_basic.h	Tue Mar  5 16:13:37 2002
@@ -102,7 +102,7 @@
 #define G_SIZE_IN_Q(type) ((sizeof(type)+sizeof(q)-1) / sizeof(q))
 
 /* runtime/gc.c */
-extern void make_larger_stack(void);
+extern void push_gc_stack(q* addr);
 
 
 /** G_COPY_KL1_TERM_TO_NEWGEN: procedure
@@ -111,19 +111,15 @@
  */
 #define G_COPY_KL1_TERM_TO_NEWGEN(from,to) \
 do{ \
-  if (gcsp() == gcmax()) { \
-    make_larger_stack(); \
-  } \
   if(isref(from)) { \
     q *newword = g_allocp++; \
     derefone(newword) = (from); \
     (to) = makeref(newword); \
-    *gcsp() = newword; \
+    push_gc_stack(newword); \
   } else { \
     (to) = (from); \
-    *gcsp() = &(to); \
+    push_gc_stack(&(to)); \
   } \
-  set_gcsp(gcsp() + 1); \
   assert(g_allocp >= heapp()); \
 }while(0)
 
diff -ruN klic-3.003-2002-03-05c/runtime/gc.c klic-3.003-2002-03-05d/runtime/gc.c
--- klic-3.003-2002-03-05c/runtime/gc.c	Tue Mar  5 15:54:43 2002
+++ klic-3.003-2002-03-05d/runtime/gc.c	Tue Mar  5 16:24:50 2002
@@ -54,7 +54,7 @@
   set_old_space_size(temps);
 }
 
-extern void
+static void
 make_larger_stack(void)
 {
   declare_globals;
@@ -100,7 +100,7 @@
   return (unsigned long)x - (unsigned long)old_space_top() < old_space_size();
 }
 
-static void push_gc_stack(q* addr)
+extern void push_gc_stack(q* addr)
 {
   if(gcsp() == gcmax())
     make_larger_stack();
@@ -142,6 +142,7 @@
   int n = og->pred->arity;				\
   struct goalrec* ng = (struct goalrec*) hp;		\
   hp += n + 2;						\
+  set_heapp(hp); \
   ng->next = og->next;					\
   og->next = ng;					\
   ng->pred = og->pred;					\
@@ -193,6 +194,7 @@
 	}else{
 	  q newcons = makecons(hp);
 	  hp += 2;
+	  set_heapp(hp);
 	  reserve_copy(car_of(obj), car_of(newcons));
 	  *addr = cdr_of(obj) = newcons;
 	  if( isatomic(cdr) ){
@@ -226,6 +228,7 @@
 	  q newfunct = makefunctor(hp);
 	  int k = arityof(f);
 	  hp += k+1;
+	  set_heapp(hp);
 	  *addr = functor_of(obj) = newfunct;
 	  functor_of(newfunct) = f;
 	  do{
@@ -271,6 +274,7 @@
 	    }else{
 	      *addr = derefone(obj) = *hp = makeref(hp);
 	      hp++;
+	      set_heapp(hp);
 	    }
 	  }else{
 	    struct susprec* s = suspp(value);
@@ -282,8 +286,10 @@
 	      q newvar = *addr = derefone(obj) = makeref(hp);
 
 	      hp++;
+	      set_heapp(hp);
 	      newgsusp = generator_suspp(hp);
 	      hp += sizeof(struct generator_susp) / sizeof(q);
+	      set_heapp(hp);
 	      derefone(newvar) = makeref(newgsusp);
 	      newgsusp->backpt = makeref(newvar);
 	      oldobj = untag_generator_susp(gsusp->u.o);
@@ -311,6 +317,7 @@
 	      /* make a new variable, anyway */
 	      newvar = *addr = derefone(obj) = *hp = makeref(hp);
 	      hp++;
+	      set_heapp(hp);
 	      lastu.l = 0;
 	      do{
 		union goal_or_consumer u = h->u;
@@ -345,6 +352,7 @@
 		  if( lastu.l != 0 ){
 		    struct hook* nh = (struct hook*) hp;
 		    hp += sizeof(struct hook)/sizeof(q);
+		    set_heapp(hp);
 		    nh->u = lastu;
 		    last->next = nh;
 		    last = nh;
@@ -357,6 +365,7 @@
 	      if( lastu.l != 0 ){
 		struct susprec* ns = (struct susprec*) hp;
 		hp += sizeof(struct susprec)/sizeof(q);
+		set_heapp(hp);
 		last->next = &ns->u.first_hook;
 		ns->backpt = newvar;
 		ns->u.first_hook.next = dummy.next;
diff -ruN klic-3.003-2002-03-05c/runtime/gmvv.c klic-3.003-2002-03-05d/runtime/gmvv.c
--- klic-3.003-2002-03-05c/runtime/gmvv.c	Tue Mar  5 15:48:42 2002
+++ klic-3.003-2002-03-05d/runtime/gmvv.c	Tue Mar  5 16:16:37 2002
@@ -163,19 +163,10 @@
     /* Deep version */
     newself->index = GD_SELF->index;
     GD_COPY_KL1_TERM_TO_NEWGEN(GD_SELF->next, newself->next);
-    /*
-     * The following macro is manually expanded inline here
-     * to avoid type conflict problem.
-     *
-     * GD_COPY_KL1_TERM_TO_NEWGEN(GD_SELF->body, newself->body);
-     */
+
+    /* GD_COPY_KL1_TERM_TO_NEWGEN(GD_SELF->body, newself->body); */
     newself->body = GD_SELF->body;
-    if (gcsp() == gcmax()) {
-      make_larger_stack();
-    }
-    *gcsp() = (q*) &(newself->body);
-    set_gcsp(gcsp() + 1);
-    /* End of manual expansion */
+    push_gc_stack((q*) &(newself->body));
   }
   set_heapp(g_allocp);
   GD_RETURN_FROM_GC(newself);
