anchor.diff:              {ok, Tid}
       end.
   
  -
  -handle_sub_event(subscribe, T, {ClientId, QoS, {error, not_found}}) ->
  +handle_sub_event(_, subscribe, T, {ClientId, QoS, {error, not_found}}) ->
       %% no local process found for client id
       ets:insert(T, {{ClientId, QoS}, undefined});
  -handle_sub_event(subscribe, T, {ClientId, QoS, QPids}) ->
  -    Objects = [{{ClientId, QoS}, Pid} || Pid <- QPids],
  -    ets:insert(T, Objects);
  -handle_sub_event(subscribe, T, Node) ->
  +handle_sub_event(_, subscribe, T, {ClientId, QoS, QPids}) ->
  +    ets:insert(T, {{ClientId, QoS}, QPids});
  +handle_sub_event(_, subscribe, T, Node) ->
       case ets:insert_new(T, {{node, Node}, 1}) of
           true ->
               ok;
           false ->
               ets:update_counter(T, {node, Node}, 1)
       end;
  -handle_sub_event(unsubscribe, T, {ClientId, QoS}) ->
  +handle_sub_event(TabKey, unsubscribe, T, {ClientId, QoS}) ->
       ets:delete(T, {ClientId, QoS}),
       case ets:info(T, size) of
  -        0 -> ets:delete(T);
  +        0 ->
  +            ets:delete(vmq_reg_pets, TabKey),
  +            ets:delete(T);
           _ -> ok
       end;
  -handle_sub_event(unsubscribe, T, Node) ->
  +handle_sub_event(TabKey, unsubscribe, T, Node) ->
       case ets:update_counter(T, {node, Node}, -1) of
           R when R =< 0 ->
               ets:delete(T, {node, Node}),
               case ets:info(T, size) of
  -                0 -> ets:delete(T);
  +                0 ->
  +                    ets:delete(vmq_reg_pets, TabKey),
  +                    ets:delete(T);
                   _ -> ok
               end;
           _ ->
  
positive.code:     case find_cache_table({MountPoint, Topic}) of
          {ok, T} -> T;
          {error, not_found} ->
              T = ets:new(?MODULE, [public, bag, {read_concurrency, true}]),
              ets:insert(?MODULE, {{MountPoint, Topic}, T}),
              case Parent == self() of
                  true ->
                      T;
                  false ->
                      ets:give_away(T, Parent, ?MODULE),
                      T
              end
      end.
  
negative.code: 
  initialize_tables({MP, Topic, Val}, Parent) ->
      T = ensure_table_exists(MP, Topic, Parent),
      handle_sub_event({MP, Topic}, subscribe, T, Val),
      Parent.
  
  ensure_table_exists(MountPoint, Topic) ->
  