anchor.diff:  can_lock(Tid, read, {Tab, Key}, AlreadyQ) when Key /= ?ALL ->
       %% The key is bound, no need for the other BIF
       Oid = {Tab, Key},
  -    ObjLocks = ?ets_match_object(mnesia_held_locks, {{Oid, '_'}, write}),
  -    TabLocks = ?ets_match_object(mnesia_held_locks, {{{Tab, ?ALL}, '_'}, write}),
  +    ObjLocks = filter_write(?ets_lookup(mnesia_held_locks, Oid)),
  +    TabLocks = filter_write(?ets_lookup(mnesia_held_locks, {Tab, ?ALL})),
       check_lock(Tid, Oid, ObjLocks, TabLocks, yes, AlreadyQ, read);
   
   can_lock(Tid, read, Oid, AlreadyQ) -> % Whole tab
       Tab = element(1, Oid),
  -    ObjLocks = ?ets_match_object(mnesia_held_locks, {{{Tab, '_'}, '_'}, write}),
  +    ObjLocks = ?ets_match_object(mnesia_held_locks, {{Tab, '_'}, write, '_'}),
       check_lock(Tid, Oid, ObjLocks, [], yes, AlreadyQ, read);
   
   can_lock(Tid, write, {Tab, Key}, AlreadyQ) when Key /= ?ALL ->
       Oid = {Tab, Key},
  -    ObjLocks = ?ets_match_object(mnesia_held_locks, ?match_oid_held_locks(Oid)),
  -    TabLocks = ?ets_match_object(mnesia_held_locks, ?match_oid_held_locks({Tab, ?ALL})),
  +    ObjLocks = ?ets_lookup(mnesia_held_locks, Oid),
  +    TabLocks = ?ets_lookup(mnesia_held_locks, {Tab, ?ALL}),
       check_lock(Tid, Oid, ObjLocks, TabLocks, yes, AlreadyQ, write);
   
   can_lock(Tid, write, Oid, AlreadyQ) -> % Whole tab
  
positive.code: check_lock(Tid, Oid, [], TabLocks, X, AlreadyQ, Type) ->
      check_lock(Tid, Oid, TabLocks, [], X, AlreadyQ, Type).
  
  %% True if  WaitForTid > Tid -> % Important order
  allowed_to_be_queued(WaitForTid, Tid) ->
      case get(pid_sort_order) of
  
negative.code: 
  get_held_locks() ->
      ?MODULE ! {get_table, self(), mnesia_held_locks},
      Locks = receive {mnesia_held_locks, Ls} -> Ls after 5000 -> [] end,
      rewrite_locks(Locks, []).
  
  rewrite_locks([{Oid, _, Ls}|Locks], Acc0) ->
      Acc = rewrite_locks(Ls, Oid, Acc0),
      rewrite_locks(Locks, Acc);
  rewrite_locks([], Acc) ->
      lists:reverse(Acc).
  
  rewrite_locks([{Op, Tid}|Ls], Oid, Acc) ->
      rewrite_locks(Ls, Oid, [{Oid, Op, Tid}|Acc]);
  rewrite_locks([], _, Acc) ->
      Acc.
  
  get_lock_queue() ->
      ?MODULE ! {get_table, self(), mnesia_lock_queue},
      Q = receive {mnesia_lock_queue, Locks} -> Locks after 5000 -> [] end,
      [{Oid, Op, Pid, Tid, WFT} || {queue, Oid, Tid, Op, Pid, WFT} <- Q].
  
  do_stop() ->
  