tty: some fixes