Fixed #22436: More careful checking on method ref'ce serialization