anchor.diff:  	     #state{buf= <<>>}=State)
     when At =:= cur;
          At =:= {cur,0} ->
  -    case put_chars(Data, latin1, State) of
  -	{stop,_,Reply,NewState} ->
  -	    {error,Reply,NewState};
  -	Other ->
  -	    Other
  -    end;
  +    put_chars(Data, latin1, State);
   file_request({pwrite,At,Data}, 
   	     #state{handle=Handle,buf=Buf}=State) ->
       case position(Handle, At, Buf) of
   	{error,_} = Reply ->
   	    {error,Reply,State};
   	_ ->
  -	    case put_chars(Data, latin1, State) of
  -		{stop,_,Reply,NewState} ->
  -		    {error,Reply,NewState};
  -		Other ->
  -		    Other
  -	    end
  +	    put_chars(Data, latin1, State)
       end;
   file_request(datasync,
   	     #state{handle=Handle}=State) ->
       case ?PRIM_FILE:datasync(Handle) of
  -	{error,_}=Reply ->
  -	    {stop,normal,Reply,State};
  +	{error,Reason}=Reply ->
  +	    {stop,Reason,Reply,State};
   	Reply ->
   	    {reply,Reply,State}
       end;
   file_request(sync, 
   	     #state{handle=Handle}=State) ->
       case ?PRIM_FILE:sync(Handle) of
  -	{error,_}=Reply ->
  -	    {stop,normal,Reply,State};
  +	{error,Reason}=Reply ->
  +	    {stop,Reason,Reply,State};
   	Reply ->
   	    {reply,Reply,State}
       end;
   file_request(close, 
   	     #state{handle=Handle}=State) ->
  -    {stop,normal,?PRIM_FILE:close(Handle),State#state{buf= <<>>}};
  +    case ?PRIM_FILE:close(Handle) of
  +	{error,Reason}=Reply ->
  +	    {stop,Reason,Reply,State#state{buf= <<>>}};
  +	Reply ->
  +	    {stop,normal,Reply,State#state{buf= <<>>}}
  +    end;
   file_request({position,At}, 
   	     #state{handle=Handle,buf=Buf}=State) ->
       case position(Handle, At, Buf) of
  
positive.code: 		  when is_list(Reply);
  		       is_binary(Reply) ->
  		    {reply,{ok,Reply},NewState};
  		{stop,_,Reply,NewState} ->
  		    {error,Reply,NewState};
  		Other ->
  		    Other
  	    end
  
negative.code:     case unicode:characters_to_binary(Chars,InEncoding,OutEncoding) of
  	Bin when is_binary(Bin) ->
  	    case ?PRIM_FILE:write(Handle, Bin) of
  		{error,Reason}=Reply ->
  		    {stop,Reason,Reply,NewState};
  		Reply ->
  		    {reply,Reply,NewState}
  	    end;
  	{error,_,_} ->
  	    {stop,no_translation,
  	     {error,{no_translation, InEncoding, OutEncoding}},
  	     NewState}
      end.
  