fix a bug when saving