rewrote how defined errnos are checked