Fix middleware tests.