I have been reading the following paper Black-Box Variational Inference as Distilled Langevin Dynamics. Very early on in the paper is equation one, which considers a base probability density $q_0 : \mathbb{R}^m\to\mathbb{R}_+$ that is transformed according to the change-of-variables formula under a smooth, invertible transformation $g:\mathbb{R}^m\to\mathbb{R}^m$. Namely, let $q_{g}(\theta) = q(g^{-1}(\theta)) \vert\mathrm{det}(\nabla g^{-1}(\theta))\vert$ be the pushforward density of $q_0$ under the transformation $g$. Let $p:\mathbb{R}^m\to\mathbb{R}_+$ be another probability density and consider the KL divergence between $q_{g}$ and $p$: \begin{align} \mathrm{KL}(q_g\Vert p) &= \int q_g(x)\log\frac{q_g(x)}{p(x)}~\mathrm{d}x \\ &= \int q_0(\epsilon) \log \frac{q_g(g(\epsilon))}{p(g(\epsilon))} ~\mathrm{d}\epsilon \\ &= \int q_0(\epsilon) \log \frac{q_0(\epsilon) / \vert \mathrm{det}(\nabla g(\epsilon))\vert}{p(g(\epsilon))} ~\mathrm{d}\epsilon. \end{align} The paper claims that the functional derivative of the KL divergence with respect to the smooth transformation $g$ is $\frac{\delta}{\delta g}\mathrm{KL}(q_g\Vert p) = \nabla \log q_g(g(\cdot)) - \nabla \log p(g(\cdot))$. I am having trouble deriving this and am looking for some help.
Let's write the KL divergence as, \begin{align} \mathrm{KL}(q_g\Vert p) = \int q_0(\epsilon) \log q_0(\epsilon) ~\mathrm{d}\epsilon - \int q_0(\epsilon) \log \vert \mathrm{det}(\nabla g(\epsilon))\vert ~\mathrm{d}\epsilon - \int q_0(\epsilon) \log p(g(\epsilon)). \end{align} The first term has no dependency on $g$ and can therefore be ignored. Let's examine the third term and try to compute its functional derivative \begin{align} -\frac{\delta}{\delta g}\int q_0(\epsilon) \log p(g(\epsilon)) ~\mathrm{d}\epsilon = -q_0(\epsilon) \nabla \log p(g(\epsilon)). \end{align} This is nearly the same as the last term in the claimed functional derivative except that there is a factor of $q_0(\epsilon)$ present. This already makes me think I'm not proceeding along the correct path for the derivation.