modify middleware