update middlewares