It's really interesting how easily things can go wrong, especially with electrical issues in the home, I think it's one of the major causes of fires. With some care it's not an issue, but problems occur as you have said. I think you're lucky things didn't go badly.
It seems you have a good understanding of preparation and that's good, a little goes a long way.