Fix: global name 'tenant' is not defined