Better tty handling