anchor.diff:        btS32: SaveStream.Write(tbts32(Src^)); //Integer
         btSingle: SaveStream.Write(tbtsingle(Src^));
         btStaticArray:begin
  -                      ArrayCount := TPSTypeRec_StaticArray(aType).Size;
  -                      SaveStream.Write(ArrayCount);
  -                      for I:=0 to ArrayCount-1 do
  +                      ElemCount := TPSTypeRec_StaticArray(aType).Size;
  +                      SaveStream.Write(ElemCount);
  +                      for I:=0 to ElemCount-1 do
                         begin
                           Offset := TPSTypeRec_Array(aType).ArrayType.RealSize * I;
                           SaveVar(Pointer(IPointer(Src) + Offset), TPSTypeRec_Array(aType).ArrayType);
                         end;
                       end;
         btArray:      begin
  -                      ArrayCount := PSDynArrayGetLength(Pointer(Src^), aType);
  -                      SaveStream.Write(ArrayCount);
  -                      for I:=0 to ArrayCount-1 do
  +                      ElemCount := PSDynArrayGetLength(Pointer(Src^), aType);
  +                      SaveStream.Write(ElemCount);
  +                      for I:=0 to ElemCount-1 do
                         begin
                           Offset := TPSTypeRec_Array(aType).ArrayType.RealSize * I;
                           SaveVar(Pointer(IPointer(Src^) + Offset), TPSTypeRec_Array(aType).ArrayType);
                         end;
                       end;
  +      btRecord:     begin
  +                      ElemCount := TPSTypeRec_Record(aType).FieldTypes.Count;
  +                      SaveStream.Write(ElemCount);
  +                      for I := 0 to ElemCount-1 do
  +                      begin
  +                        Offset := Cardinal(TPSTypeRec_Record(aType).RealFieldOffsets[I]);
  +                        SaveVar(Pointer(IPointer(Src) + Offset), TPSTypeRec_Record(aType).FieldTypes[I]);
  +                      end;
  +                    end;
         //Already checked and reported as an error in LinkRuntime, no need to crash it here
         //else Assert(False);
       end;
  
positive.code: 
    procedure SaveVar(Src: Pointer; aType: TPSTypeRec);
    var
      ArrayCount: Integer;
      I: Integer;
      Offset: Cardinal;
    begin
  
negative.code:     I: Integer;
      Offset: Cardinal;
    begin
      //Check against our set of allowed types
      if not (aType.BaseType in VALID_GLOBAL_VAR_TYPES) then
      begin
        Result := 'Unsupported global variable type ' + IntToStr(aType.BaseType) + ': ' + aType.ExportName + '|';
        Exit;
      end;
      //Check elements of arrays/records are valid too
      case aType.BaseType of
        btArray,
        btStaticArray: Result := ValidateVarType(TPSTypeRec_Array(aType).ArrayType);
        btRecord: begin
                    Result := '';
                    for I:=0 to TPSTypeRec_Record(aType).FieldTypes.Count-1 do
                    begin
                      Result := Result + ValidateVarType(TPSTypeRec_Record(aType).FieldTypes[I]);
                    end;
                  end;
      end;
    end;
  
  