fix more possible crashes due to logging