fix serialization of reference fields