fix bugs which could not let client connect twice...