use serialize and deserialize in attr()