fixed serialization method