Fixes to the critical error flow and some logging