fix bug, fail connect would exit