anchor.diff:  handle_call(list, _From, State = #state{socket = S}) ->
       Msg = <<?BUCKETS>>,
       ok = gen_tcp:send(S, Msg),
  -    case gen_tcp:recv(S, 4, 3000) of
  -        {ok, <<Size:32/integer>>} ->
  -            {ok, D} = gen_tcp:recv(S, Size, 3000),
  +    case gen_tcp:recv(S, 0, 3000) of
  +        {ok, <<Size:32/integer, D:Size/binary>>} ->
               {reply, {ok, decode_metrics(D, [])}, State};
           {error, E} ->
               lager:error("[connection/recv] Error: ~p", [E]),
               gen_tcp:close(S),
               {ok, S1} = gen_tcp:connect(State#state.host, State#state.port,
  -                                       [binary, {packet, 0}, {active, false}]),
  +                                       [binary, {packet, 4}, {active, false}]),
               ok = gen_tcp:send(S1, Msg),
  -            {ok, <<Size:32/integer>>} = gen_tcp:recv(S, 4, 3000),
  -            case gen_tcp:recv(S1, Size, 3000) of
  -                {ok, D} ->
  +            case gen_tcp:recv(S, 0, 3000) of
  +                {ok, <<Size:32/integer, D:Size/binary>>} ->
                       {reply, {ok, decode_metrics(D, [])}, State};
                   E ->
                       {reply, E, State#state{socket = S1}}
  
positive.code: %%--------------------------------------------------------------------
  init([Host, Port]) ->
  	{ok, MaxRead} = application:get_env(dalmatiner_frontend, max_read),
      {ok, S} = gen_tcp:connect(Host, Port, [binary, {packet, 0}, {active, false}]),
      {ok, #state{socket = S, host=Host, port=Port, max_read=MaxRead}}.
  
  %%--------------------------------------------------------------------
  
negative.code: 
  do_list(Bucket, State = #state{socket = S}) ->
      ok = gen_tcp:send(S, <<?LIST, (dproto_tcp:encode_list(Bucket))/binary>>),
      case gen_tcp:recv(S, 0, 3000) of
          {ok, <<Size:32/integer, Reply:Size/binary>>} ->
              Ms = decode_metrics(Reply, []),
              io:format("metrics: ~p~n", [length(Ms)]),
              {Ms, State#state{metrics = gb_trees:enter(Bucket, {now(), Ms}, State#state.metrics)}};
          {error, _} ->
              gen_tcp:close(S),
              {ok, S1} = gen_tcp:connect(State#state.host, State#state.port,
                                         [binary, {packet, 4}, {active, false}]),
              {ok, <<Size:32/integer, Reply:Size/binary>>} = gen_tcp:recv(S, 0, 3000),
              Ms = decode_metrics(Reply, []),
              {Ms, State#state{metrics = gb_trees:enter(Bucket, {now(), Ms}, State#state.metrics),
                               socket = S1}}
  