Fix host selection logic.