fixing edit func