Fixed bug when saving