anchor.diff:                      LastResult1 = last_result(Results),
                       Count1 = Count + length(Results),
                       {iolist_to_binary(Body),
  -                     index_stream_helper(ReqID, Boundary, ReturnTerms, MaxResults, LastResult1, Count1)};
  +                     index_stream_helper(ReqID, Boundary, ReturnTerms, MaxResults, Timeout, LastResult1, Count1)};
                   {ReqID, Error} ->
                       lager:error("Error in index wm: ~p", [Error]),
  -                    ErrorJson = mochijson2:encode({struct, [{error, Error}]}),
  +                    ErrorJson = encode_error(Error),
                       Body = ["\r\n--", Boundary, "\r\n",
                               "Content-Type: application/json\r\n\r\n",
                               ErrorJson,
                               "\r\n--", Boundary, "--\r\n"],
                       {iolist_to_binary(Body), done}
  -            after 60000 ->
  +            after Timeout ->
                       {error, timeout}
               end
       end.
  +
  +encode_error({error, E}) ->
  +    encode_error(E);
  +encode_error(Error) when is_atom(Error); is_binary(Error) ->
  +    mochijson2:encode({struct, [{error, Error}]});
  +encode_error(Error) ->
  +    E = io_lib:format("~p",[Error]),
  +    mochijson2:encode({struct, [{error, iolist_to_binary(E)}]}).
   
   handle_all_in_memory_index_query(RD, Ctx) ->
       Client = Ctx#ctx.client,
  
positive.code:                             end,
                      {iolist_to_binary(Final), done};
                  {ReqID, {results, []}} ->
                      {<<>>, index_stream_helper(ReqID, Boundary, ReturnTerms, MaxResults, LastResult, Count)};
                  {ReqID, {results, Results}} ->
                      %% JSONify the results
                      JsonResults = encode_results(ReturnTerms, Results),
  
negative.code:     Opts = riak_index:add_timeout_opt(Timeout, [{max_results, MaxResults}]),
  
      {ok, ReqID} =  Client:stream_get_index(Bucket, Query, Opts),
      StreamFun = index_stream_helper(ReqID, Boundary, ReturnTerms, MaxResults, proplists:get_value(timeout, Opts), undefined, 0),
      {{stream, {<<>>, StreamFun}}, CTypeRD, Ctx}.
  
  index_stream_helper(ReqID, Boundary, ReturnTerms, MaxResults, Timeout, LastResult, Count) ->
      fun() ->
              receive
                  {ReqID, done} ->
  