updated from xzjcool

implemented serialization