fix edit function