BUG-973: fixed (de)serialization of union type.