Added registerFatalErrorShutdownFunction and test