Fix crashes due to logging problems