improved connect in client