Fix retry connect code