Fix an intermittent error where the loopback connection would fail