fix bugs for telnet