fixed endpoint swap issue in connection