add tty handling for FreeBSD