Improve handling of typed serialization, to avoid a bogus error