now its the hard part, you may have to check the wires themselves, and the connections in the wiring harness, and to the ignition. In another word, all the wiring.
My bike was shutting off occassionall when I am riding, come to find out one of the connectors to the main relay was loose, and I had to bypass it at the relay.