useing short screws like 3/4 inch screw thru back(perhaps have to drill holes in box) into back wood in hole
or use furing strip section to build up to screw into
use your head, it only needs a screw ot two to hold it
you could buy the old work box with the ears and transfer them over to the shallow box
or a trip to electric supply for shallow old work box, not home depot a real epectric supply house in your town
dp