Fix middlewares