I don't know if this is your trouble or not. But one time after I worked on my distributor I started my car and boom it sometimes backfired like a gun going off. The problem turned out to be a wire grounding out on the metal inside the distributor.