Add ENOTDIR check. (may need to be added to more checks)