fixed connection thread bug