anchor.diff:              {error, Reason}
       end.
   
  -find_acc(_, _, [], Acc) ->
  +find_acc(_, [], Acc) ->
       lists:reverse(Acc);
  -find_acc(Conn, Prefix, [Id | Rest], Acc) ->
  -    case find(Conn, Prefix ++ binary_to_list(Id)) of
  +find_acc(Prefix, [Id | Rest], Acc) ->
  +    case find(undefined, Prefix ++ binary_to_list(Id)) of
           {error, _Reason} ->
  -            find_acc(Conn, Prefix, Rest, Acc);
  +            find_acc(Prefix, Rest, Acc);
   
           Value ->
  -            find_acc(Conn, Prefix, Rest, [Value | Acc])
  +            find_acc(Prefix, Rest, [Value | Acc])
       end.
   
   % this is a stub just to make the tests runable
  -find(Conn, Type, Conditions, Max, Skip, Sort, SortOrder) ->
  -    {ok, Keys} = riakc_pb_socket:list_keys(Conn, type_to_bucket_name(Type)),
  -    AllRecords = find_acc(Conn, atom_to_list(Type) ++ "-", Keys, []),
  +find(_, Type, Conditions, Max, Skip, Sort, SortOrder) ->
  +    {ok, Keys} = riakpool_client:list_keys(type_to_bucket_name(Type)),
  +    AllRecords = find_acc(atom_to_list(Type) ++ "-", Keys, []),
       Records = case Conditions of
           [{Key, 'gt', Value}] -> [Record || Record <- AllRecords,
                                    Record:Key() > Value];
  
positive.code:     % TODO: crypto is needed for unique_id_62/0. Remove it when
      %       unique_id_62/0 is not needed.
      crypto:start(),
      Host = proplists:get_value(db_host, Options, "localhost"),
      Port = proplists:get_value(db_port, Options, 8087),
      riakc_pb_socket:start_link(Host, Port).
  
  stop(Conn) ->
      riakc_pb_socket:stop(Conn),
      ok.
  
  find(Conn, Id) ->
      {Type, Bucket, Key} = infer_type_from_id(Id),
      case riakc_pb_socket:get(Conn, Bucket, Key) of
          {ok, RiakDoc} ->
              [Value|_] = riakc_obj:get_values(RiakDoc),
              Data = binary_to_term(Value),
              DummyRecord = apply(Type, new, lists:seq(1, proplists:get_value(new,
                                   Type:module_info(exports)))),
  
negative.code:     {error, notimplemented}.
  
  
  delete(_, Id) ->
      {_Type, Bucket, Key} = infer_type_from_id(Id),
      ok = riakpool_client:delete(Bucket, Key).
  
  save_record(_, Record) ->
      Type = element(1, Record),
      Bucket = type_to_bucket_name(Type),
      PropList = [{K, V} || {K, V} <- Record:attributes(), K =/= id],
      Key = case Record:id() of
          id ->
              % TODO: The next release of Riak will support server-side ID
              %       generating. Get rid of unique_id_62/0.
              unique_id_62();
          DefinedId when is_list(DefinedId) ->
              [_, DefinedKey] = string:tokens(DefinedId, "-"),
              DefinedKey
      end,
      ok = riakpool_client:put(list_to_binary(Bucket), list_to_binary(Key),
                               term_to_binary(PropList)),
      {ok, Record:id(atom_to_list(Type) ++ "-" ++ Key)}.
  
  % These 2 functions are not part of the behaviour but are required for
  