Fix middleware in test settings.