Do the TTY check first for performance.