anchor.diff:   DFACountStatesCached:=0;
   
    // Reset and recaching start states
  - if assigned(DFAAnchoredStartState) then begin
  -  State:=DFAAnchoredStartState;
  -  FillChar(State^.NextStates,DFANextStatesSize,AnsiChar(#0));
  -  DFAStateCache.Add(State);
  -  inc(DFACountStatesCached);
  - end;
  - if assigned(DFAUnanchoredStartState) then begin
  -  State:=DFAUnanchoredStartState;
  -  FillChar(State^.NextStates,DFANextStatesSize,AnsiChar(#0));
  -  DFAStateCache.Add(State);
  -  inc(DFACountStatesCached);
  - end;
  - if assigned(DFAReversedStartState) then begin
  -  State:=DFAReversedStartState;
  -  FillChar(State^.NextStates,DFANextStatesSize,AnsiChar(#0));
  -  DFAStateCache.Add(State);
  -  inc(DFACountStatesCached);
  - end;
  - if assigned(DFADeadState) then begin
  -  State:=DFADeadState;
  -  FillChar(State^.NextStates,DFANextStatesSize,AnsiChar(#0));
  -  DFAStateCache.Add(State);
  -  inc(DFACountStatesCached);
  + begin
  +
  +  if assigned(DFAAnchoredStartState) then begin
  +   State:=DFAAnchoredStartState;
  +   FillChar(State^.NextStates,DFANextStatesSize,AnsiChar(#0));
  +   DFAStateCache.Add(State);
  +   inc(DFACountStatesCached);
  +  end;
  +
  +  if assigned(DFAUnanchoredStartState) then begin
  +   State:=DFAUnanchoredStartState;
  +   FillChar(State^.NextStates,DFANextStatesSize,AnsiChar(#0));
  +   DFAStateCache.Add(State);
  +   inc(DFACountStatesCached);
  +  end;
  +
  +  if assigned(DFAReversedStartState) then begin
  +   State:=DFAReversedStartState;
  +   FillChar(State^.NextStates,DFANextStatesSize,AnsiChar(#0));
  +   DFAStateCache.Add(State);
  +   inc(DFACountStatesCached);
  +  end;
  +
  +  if assigned(DFADeadState) then begin
  +   State:=DFADeadState;
  +   FillChar(State^.NextStates,DFANextStatesSize,AnsiChar(#0));
  +   DFAStateCache.Add(State);
  +   inc(DFACountStatesCached);
  +  end;
  +
  +  for Index:=0 to length(DFAStartStates)-1 do begin
  +   for SubIndex:=0 to length(DFAStartStates[Index])-1 do begin
  +    State:=DFAStartStates[Index,SubIndex];
  +    if assigned(State) then begin
  +     FillChar(State^.NextStates,DFANextStatesSize,AnsiChar(#0));
  +     DFAStateCache.Add(State);
  +     inc(DFACountStatesCached);
  +    end;
  +   end;
  +  end;
  +
    end;
   
   end;
  
positive.code: end;
  
  constructor TFLREThreadLocalStorageInstance.Create(AInstance:TFLRE);
  var Index:longint;
      FLREDFAStateCreateTempDFAState:TFLREDFAState;
  begin
   inherited Create;
  
  
negative.code:  if assigned(DFADeadState) then begin
    DFAFreeState(DFADeadState);
    FreeMem(DFADeadState);
   end;
   for Index:=0 to length(DFAStartStates)-1 do begin
    for SubIndex:=0 to length(DFAStartStates[Index])-1 do begin
     if assigned(DFAStartStates[Index,SubIndex]) then begin
      DFAFreeState(DFAStartStates[Index,SubIndex]);
      FreeMem(DFAStartStates[Index,SubIndex]);
     end;
    end;
   end;
   FreeAndNil(DFAStateCache);
   SetLength(DFAStackInstructions,0);
  