Fix `req` variable declaration

It should be a local variable, not global.