fix connect error check