Remove middlewares that will be rendered useless