Fix order of middleware.