Fix a bug with serialization: field values should have been compared against default values before serialization, not after. This was manifested when serializing structs.