tweak middleware.