fix possible race in the initial connection open

Modified patch from Cliff Moon