add a function of update