fixed edit function.