Fixed a bug when saving.