If it works part of the time, chances it's not an electrical problem. Check all air hose connection. You may have an air leak. Also look at the air filter.
Check the ground. Make sure its clean and dab a little dielectric grease on the connections.