fixing fatal error check