Fix custom serialization