Fixed bug for OnSave