update before leaving