Fix bug in attribute serialization