serialization stackoverflow fix