anchor.diff:  	      enter_type(NewKey, Val, MS);
   	    error ->
   	      ?debug("Entering ~p :: ~s\n", [KeyLabel, t_to_string(Val)]),
  -	      case dict:find(KeyLabel, Map) of
  +	      case dict:find(KeyLabel, Dict) of
   		{ok, Val} -> MS;
  -		{ok, _OldVal} -> {dict:store(KeyLabel, Val, Map), Subst};
  -		error -> {dict:store(KeyLabel, Val, Map), Subst}
  +		{ok, _OldVal} -> store_map(KeyLabel, Val, MS);
  +		error -> store_map(KeyLabel, Val, MS)
   	      end
   	  end
         end
     end.
   
  -enter_subst(Key, Val, {Map, Subst} = MS) ->
  +store_map(Key, Val, #map{dict = Dict, ref = undefined} = Map) ->
  +  Map#map{dict = dict:store(Key, Val, Dict)};
  +store_map(Key, Val, #map{dict = Dict, modified = Mod} = Map) ->
  +  Map#map{dict = dict:store(Key, Val, Dict), modified = [Key | Mod]}.
  +
  +enter_subst(Key, Val, #map{subst = Subst} = MS) ->
     KeyLabel = get_label(Key),
     case cerl:is_literal(Val) of
       true ->
  -      NewMap = dict:store(KeyLabel, literal_type(Val), Map),
  -      {NewMap, Subst};
  +      store_map(KeyLabel, literal_type(Val), MS);
       false ->
         case cerl:is_c_var(Val) of
   	false -> MS;
  
positive.code: 	      if KeyLabel =:= ValLabel -> MS;
  		 true ->
  		  ?debug("Subst: storing ~p = ~p\n", [KeyLabel, ValLabel]),
  		  NewSubst = dict:store(KeyLabel, ValLabel, Subst),
  		  {Map, NewSubst}
  	      end
  	  end
        end
    end.
  
  lookup_type(Key, {Map, Subst}) ->
    lookup(Key, Map, Subst, t_none()).
  
  lookup(Key, Map, Subst, AnyNone) ->
    case cerl:is_literal(Key) of
      true -> literal_type(Key);
      false ->
        Label = get_label(Key),
        case dict:find(Label, Subst) of
  	{ok, NewKey} -> lookup(NewKey, Map, Subst, AnyNone);
  	error ->
  	  case dict:find(Label, Map) of
  	    {ok, Val} -> Val;
  	    error -> AnyNone
  	  end
  
negative.code:                                    RaceListSize + 1, State1);
            false -> State1
          end,
        Map2 = join_maps_begin(Map1),
        {MapList, State3, Type} =
  	handle_clauses(Clauses, Arg, ArgType, ArgType, State2,
  		       [], Map2, [], []),
        Map3 = join_maps_end(MapList, Map2),
        debug_pp_map(Map2),
        {State3, Map3, Type}
    end.
  
  %%----------------------------------------
  