edit function correction