Fixed the middleware.