fix bug in serialization