Fixed race condition on connection.