update api for middleware's next