Fix a bug in serializer