Added more logging/checks around fatal errors.