update before sleep