After looking at the photo, it is possible that moisture was a problem inside the ATS switch. The ground wires are very dull looking. Though perhaps the fumes from burning insulation caused the dullness. I don't think that wire nuts are appropriate for mobile applications due to vibrations. High current carrying applications can add to the problem. There are crimp-on connectors and set screw butt connectors that might be better.
__________________
|