changed fatal error handling to use new error functions