Fixing middleware.