For locking a stud into position, get yourself or grind up a ‘layout’ centre punch (60 deg tip).
Find the depth the stud screws into the casting, and about 2 or 3 threads down from the top thread, go around the root of the stud thread with the centre punch. You should only need about four equi spaced pops around the one thread core.
Once tightened in using the double nut technique on the stud top threads, that will quite effectively act as a stud lock to stop it unscrewing.
Another method is to put strips of bacofoil, about 4, down inside the edges of the tapped hole, then screw in the stud. That should make up enough of the deficiency between the stud and hole size to make it tighter. I have used up to 0.004″ ali shim before now to get real sloppy studs to tighten up. Trim off the sticking up bits with a stanley knife after it is assembled. Drink can material is around that sort of thickness.
Not a pretty site, but it gets the job done.
Bogs