anchor.diff:  end;
   
   function TAppParam.GetAsStream(Stream: TStream): Integer;
  -var s : AnsiString;
  +var bytes : TBytes;
   begin
     Stream.Size := 0;
     if IsNull then Result := 0
     else begin
  -    s := VarToStrDef(FValue,'');
  -    Stream.Size := 0;
  -    Stream.WriteBuffer(s[1],length(s));
  -    Stream.Position := 0;
  -  end;
  -end;
  -
  -function TAppParam.GetAsString(Const DefValue : AnsiString): AnsiString;
  +    bytes := GetAsTBytes(Nil);
  +    if Length(bytes)>0 then begin
  +      Stream.WriteBuffer(bytes[0],Length(bytes));
  +      Stream.Position := 0;
  +    end;
  +    Result := Length(bytes);
  +  end;
  +end;
  +
  +function TAppParam.GetAsString(const DefValue: String): String;
   begin
     if IsNull then Result := DefValue
     else Result := VarToStrDef(FValue,DefValue);
   end;
   
  +function TAppParam.GetAsTBytes(const DefValue: TBytes): TBytes;
  +begin
  +  if IsNull then SetLength(Result,0)
  +  else begin
  +    Try
  +    if (ParamType=(ptString)) then begin
  +      Result := TEncoding.ANSI.GetBytes(VarToStr(FValue));
  +    end else Result := Copy(FBytesValue);
  +    Except
  +      Result := DefValue;
  +    End;
  +  end;
  +end;
  +
   function TAppParam.GetIsNull: Boolean;
   begin
     Result := VarIsNull( FValue );
   end;
   
  -Function TAppParam.LoadFromStream(Stream: TStream)  : Boolean;
  +function TAppParam.LoadFromStream(Stream: TStream): Boolean;
   Var bpt : Byte;
     pt : TAppParamType;
  -  s : AnsiString;
     i : Integer;
     c : Cardinal;
     i64 : Int64;
  +  bytes : TBytes;
   begin
     Result := false;
  -  if TStreamOp.ReadAnsiString(Stream,FParamName)<0 then exit;
  +  // 2 bytes for length
  +  if Internal_ReadBytes(Stream,bytes)<0 then exit;
  +  FParamName := TEncoding.ANSI.GetString(bytes);
     Stream.Read(bpt,1);
     if (bpt>=Integer(low(pt))) And (bpt<=Integer(high(pt))) then pt := TAppParamType(bpt)
     else pt := ptString;
  
positive.code:   else begin
      case pt of
        ptString : begin
          If TStreamOp.ReadAnsiString(Stream,s)<0 then exit;
          FValue := s;
        end;
        ptInteger : begin
          if Stream.Read(i,sizeof(i))<sizeof(i) then exit;
  
negative.code:         else b := 0;
          Stream.Write(b,sizeof(b));
        End;
        ptBytes : Begin
          Internal_WriteBytes(Stream,FBytesValue);
        End
      else
        raise Exception.Create('Development error 20160613-2');
  