finish update function