Loop until a valid controller is found.