fix edit functionality