fixed guards, elev_run and mainfile