fixed socket disconnect handling for connection