add new code for open tty