383 Broken exhaust stud please help!

I did this recently to both a broken exhaust bolt and valve cover bolt.
Engine was out.
Drilled a hole to give myself something to stick the mig weld wire into and drew out the weld until it was above the head. I screwed a bolt on to the hot weld, but not all the way, then welded the nut on.
Turned the nut back in first and it spun right out.

My first attempt at welding the nut flush and turning out did not work, for whatever reason.