Fix race condition in initial connection.