anchor.diff:          S#state.seq, S#state.id]).
   
   ack_pre(Ss, [Ip,  Port, RIp, RPort, Seq, Ack, Id]) ->
  -  [ S ] = [ S || S<-Ss, S#state.id == Id ],
  -  in_tcp_state(Ss, Id, [syn_rcvd, last_ack, fin_wait_1, closing]) andalso
  -    S#state.seq == S#state.rcvd andalso
  -    Ip    == S#state.ip    andalso
  -    Port  == S#state.port  andalso
  -    RIp   == S#state.rip   andalso
  -    RPort == S#state.rport andalso
  -    Seq   == S#state.rseq andalso
  -    Ack   == S#state.seq.
  +  case [ S || S<-Ss, S#state.id == Id ] of
  +    [ S ] ->
  +      in_tcp_state(Ss, Id, [syn_rcvd, last_ack, fin_wait_1, closing]) andalso
  +        S#state.seq == S#state.rcvd andalso
  +        Ip    == S#state.ip    andalso
  +        Port  == S#state.port  andalso
  +        RIp   == S#state.rip   andalso
  +        RPort == S#state.rport andalso
  +        Seq   == S#state.rseq andalso
  +        Ack   == S#state.seq;
  +    _ ->
  +      false
  +  end.
   
   ack_adapt(Ss, [_, _, _, _, _, _, Id]) ->
  -  [ S ] = [ S || S<-Ss, S#state.id == Id ],
  -  [S#state.ip, S#state.port,
  -   S#state.rip,
  -   S#state.rport,
  -   S#state.rseq,
  -   S#state.seq, Id].
  +  case [ S || S<-Ss, S#state.id == Id ] of
  +    [ S ] ->
  +      [S#state.ip, S#state.port,
  +       S#state.rip,
  +       S#state.rport,
  +       S#state.rseq,
  +       S#state.seq, Id];
  +    _ ->
  +      false
  +  end.
   
   ack(Ip,  Port, RemoteIp, RemotePort, Seq, Ack, _) ->
     Packet =
  
positive.code:     Ack   == S#state.rcvd.
      
  fin_adapt(Ss, [_, _, _, _, _, _, Id]) -> 
    [ S ] = [ S || S<-Ss, S#state.id == Id ],
    [S#state.ip, S#state.port,
     S#state.rip, S#state.rport,
     S#state.rseq, S#state.rcvd, Id].
  
  fin(Ip, Port, RemoteIp, RemotePort, Seq, Ack, _) ->
    Packet =
  
negative.code:   ok.
  
  syn_pre(Ss, [Ip, Port, _, _, _, Id]) ->
    case [ S || S<-Ss, S#state.id == Id ] of
      [ S ] ->
        S#state.ip   == Ip andalso
          S#state.port == Port andalso
          in_tcp_state(Ss, Id, listen);
      _ ->
        false
    end.
  
  syn_adapt(Ss, [_, _, Ip, Port, Seq, Id]) ->
    case [ S || S<-Ss, S#state.id == Id ] of
      [ S ] ->
        [S#state.ip, S#state.port, Ip, Port, Seq, Id];
      _ ->
        false
    end.
  
  syn_callouts(_S, [_Ip,  _Port, RemoteIp, RemotePort, RemoteSeq, Id]) ->
    ?SET(Id, rip, RemoteIp),
  