Fix reference object serialization, fixes #10740 !strict