*** src/eval.c	2009-05-02 16:00:00.000000000 -0700
--- src/eval_fixed.c	2009-05-02 15:59:47.000000000 -0700
***************
*** 6544,6549 ****
--- 6544,6556 ----
  	set_ref_in_ht(&fc->l_avars.dv_hashtab, copyID);
      }
  
+     /* don't free variables in the previous_funccal list before step 4 */
+     for (fc = previous_funccal; fc != NULL; fc = fc->caller)
+     {
+ 	set_ref_in_ht(&fc->l_vars.dv_hashtab, copyID);
+ 	set_ref_in_ht(&fc->l_avars.dv_hashtab, copyID);
+     }
+ 
      /* v: vars */
      set_ref_in_ht(&vimvarht, copyID);
  
***************
*** 6585,6591 ****
  	else
  	    ll = ll->lv_used_next;
  
!     /* check if any funccal can be freed now */
      for (pfc = &previous_funccal; *pfc != NULL; )
      {
  	if (can_free_funccal(*pfc, copyID))
--- 6592,6598 ----
  	else
  	    ll = ll->lv_used_next;
  
!     /* 4. Check if any funccal can be freed now. */
      for (pfc = &previous_funccal; *pfc != NULL; )
      {
  	if (can_free_funccal(*pfc, copyID))
***************
*** 18946,18951 ****
--- 18953,18959 ----
      dictitem_T	*dict_var;
  {
      hash_init(&dict->dv_hashtab);
+     dict->dv_copyID = 0;
      dict->dv_refcount = DO_NOT_FREE_CNT;
      dict_var->di_tv.vval.v_dict = dict;
      dict_var->di_tv.v_type = VAR_DICT;
