In Elements of Information Theory, I can't figure out how the functional derivative $ \frac{\delta J}{\delta q(\hat{x}|x)} $ for $ J(q) = \sum_x \sum_{\hat{x}} p(x)q(\hat{x}|x)\log{\frac{q(\hat{x}|x)}{q(\hat{x})}} $ (from equation 10.119, ignoring the other terms of the expression which I have no problem with) leads to this result (equation 10.120, also ignoring non problematic terms): $$ \frac{\delta J}{\delta q(\hat{x}|x)} = p(x)\log{\frac{q(\hat{x}|x)}{q(\hat{x})}} + p(x) - \sum_{x'}p(x')q(\hat{x}|x')\frac{1}{q(\hat{x})} p(x) $$
In particular, I can't see where the term with the sum over x' is coming from.