Backport custom serialization support