Remove tty from session user and fix bug