better critical error handling