Fixed a bug in serialization.