anchor.diff:      else
       let fs = getObjectFields t
       let ms = fs |> Array.map (fun x -> x :> System.Reflection.MemberInfo)
  -    let es = fs |> Array.map (fun f ->
  -        let ta = TAttrs.Get(i, f.FieldType, f)
  -        (i.GetEncodedFieldName f.DeclaringType f.Name,
  -         encodeOptionalField dE ta))
  +    let es = 
  +        if t.IsValueType then
  +            fs |> Array.map (fun f ->
  +                let ta = TAttrs.Get(i, f.FieldType, f)
  +                (i.GetEncodedFieldName f.DeclaringType (f.Name.TrimEnd('@')),
  +                 encodeOptionalField dE ta))
  +        else
  +            fs |> Array.map (fun f ->
  +                let ta = TAttrs.Get(i, f.FieldType, f)
  +                (i.GetEncodedFieldName f.DeclaringType f.Name,
  +                 encodeOptionalField dE ta))
       fun (x: obj) ->
           match x with
           | null ->
  
positive.code:     let format info =
          {
              AddTag = addTag info
              GetEncodedFieldName = fun t f ->
                  let typ = AST.Reflection.ReadTypeDefinition t
                  match info.Classes.TryGetValue typ with
                  | true, cls -> 
                      match cls.Fields.[f] with
                      | M.InstanceField n
                      | M.OptionalField n -> n
                      | M.IndexedField i -> string i
                      | _ -> failwithf "A static field not serializable: %s.%s" t.FullName f                                          
                  | _ ->
                      match info.CustomTypes.TryGetValue typ with
                      | true, M.FSharpRecordInfo fs -> 
                          fs |> List.pick (fun rf -> 
                              if rf.Name = f then 
                                  Some rf.JSName
                              else None)
                      | _ -> f
              GetUnionTag = defaultGetUnionTag
              EncodeUnionTag = defaultEncodeUnionTag
              GetEncodedUnionFieldName = fun _ i -> "$" + string i
  
negative.code:         |> callGeneric <@ makeDictionary @> dD ta
      elif not t.IsSerializable then
          raise (NoEncodingException t)
      elif t.IsValueType then
          let fs = t.GetFields fieldFlags
          match t.GetConstructor (fs |> Array.map (fun f -> f.FieldType)) with
          | null -> raise (NoEncodingException t)
          | _ ->
          let ds = fs |> Array.map (fun f ->
              let ta = TAttrs.Get(i, f.FieldType, f)
              (i.GetEncodedFieldName f.DeclaringType (f.Name.TrimEnd('@')),
               decodeOptionalField dD ta))
          fun (x: Value) ->
              match x with
              | Object fields ->
                  let get = table fields
                  let data =
                      ds
                      |> Seq.map (fun (n, dec) ->
                         dec (get n))
                      |> Seq.toArray
                  System.Activator.CreateInstance(t, args = data)
              | x ->
                  raise (DecoderException(x, ta.Type))
      else
      match t.GetConstructor [||] with
      | null -> raise (NoEncodingException t)
  