fixed bug on repeated connects. please finish test cases