GPII-20: fixed middleware to not break integration tests.