The only reason that the previous implementation works is because _G ~= getfenv(1), which it should.