fix serialization bugs