Fix middleware.