McIlroy holds onto lead at Shanghai Masters, despite front-nine struggles