serializer: fix a data loss bug