modify the update function