Fix connection management.