update undo fucntion