Fixing serialization bugs