Fix connection check