update save function