Fix visit retry code so it works