I am reading Peskin & Schroeder Ch9 and am stuck on a calculation going from equation 9.36.
The problem is essentially a change of variable of a Klein-Gordon field.

Beginning, we have an integral of the KG Lagrangian and a source term

\begin{align}
\int d^4 x\: [\mathcal{L}_0(\phi) + J\phi] = \int d^4 x \left[\frac{1}{2} \phi (-\partial^2 - m^2 + i \epsilon)\phi + J\phi\right].
\end{align}
Now we want to shift the field so introduce
\begin{align}
\phi' = \phi - i\int d^4 y\: D_F(x-y)J(y).
\end{align}

Substitution is then supposed to give
\begin{align}
\int d^4 x\: [\mathcal{L}_0(\phi) + J\phi] = \int d^4 x \left[\frac{1}{2} \phi' (-\partial^2 - m^2 + i \epsilon)\phi' \right] - \int d^4x d^4y\; \frac{1}{2}J(x)[-iD_F(x-y)]J(y).
\end{align}
To do this, they use that $D_F$ is a Green's function of the KG operator, which I have been using as
\begin{align}
(-\partial^2 - m^2 + i \epsilon)i\int d^4 y\: D_F(x-y)J(y) = -J(x).
\end{align}
So I find

\begin{align}
\int d^4 x\: [\mathcal{L}_0(\phi) + J\phi] = &\int d^4 x \left[\frac{1}{2} \left(\phi' + i\int d^4 y\: D_F(x-y)J(y)\right) (-\partial^2 - m^2 + i \epsilon)\left(\phi' + i\int d^4 y\: D_F(x-y)J(y)\right) + J(x)\left(\phi' + i\int d^4 y\: D_F(x-y)J(y)\right)\right] \\ =&
\int d^4 x \left[\frac{1}{2} \phi'(-\partial^2 - m^2 + i \epsilon)\phi' - \frac{1}{2} \phi' J(x) + \frac{1}{2}  i\int d^4 y\: D_F(x-y)J(y) (-\partial^2 - m^2 + i \epsilon)\phi' \\ - \frac{1}{2} i\int d^4 y\: D_F(x-y)J(y) J(x) + J(x)\phi' + J(x)i\int d^4 y\: D_F(x-y)J(y)\right] \\= &\int d^4 x \left[\frac{1}{2} \phi' (-\partial^2 - m^2 + i \epsilon)\phi' \right] - \int d^4x d^4y\; J(x)[-iD_F(x-y)]J(y) \\ &+ \frac{1}{2}\int d^4x \: J(x)\phi' +\frac{1}{2}  i\int d^4x d^4 y\: D_F(x-y)J(y) (-\partial^2 - m^2 + i \epsilon)\phi' \\= &\int d^4 x \left[\frac{1}{2} \phi' (-\partial^2 - m^2 + i \epsilon)\phi' \right] - \int d^4x d^4y\; J(x)[-iD_F(x-y)]J(y) \\ &+ \frac{1}{2}\int d^4x \: J(x)\phi' -\frac{1}{2}  i\int d^4x d^4 y\: (-\partial^2 - m^2 + i \epsilon)D_F(x-y)J(y) \phi' + \text{boundary terms} \\= &\int d^4 x \left[\frac{1}{2} \phi' (-\partial^2 - m^2 + i \epsilon)\phi' \right] - \int d^4x d^4y\; J(x)[-iD_F(x-y)]J(y) \\ &+ \int d^4x \: J(x)\phi' ,
\end{align}
where the boundary terms come from integration by parts. I'm off by a factor of $\frac{1}{2}$ in the second term, and I also have an additional term, but I can't see where it's going wrong.