fixed connect and listen bug