Fix bug of connection