update before save