In Notes for a course on Classical Fields by R. ALdrovandi, one the the exercises in page 94 is to derive the klein Gordon equation $(\Box + m²)\phi = 0$ from the following lagrangian density
\begin{equation} \mathcal{L} = \frac{1}{2} (\partial _\mu \phi \partial ^{\mu}\phi - m² \phi ²).\tag{1} \end{equation} which I've solved. Here the sign convention is $(+,-,-,-)$. But after he states:
"Show that it (KG Equation) comes also from" \begin{align} \mathcal{L} &= \frac{1}{2} (\phi \partial _\mu \partial ^\mu \phi + m² \phi ²). \tag{2}\\ \end{align}
My problem is when I make the variation in the lagrangian I get the following problem
\begin{align} \delta S &= \int d⁴ x \left( \frac{\partial \mathcal{L}}{\partial \phi} \delta\phi + \frac{\partial \mathcal{L}}{\partial(\partial_\lambda \phi))}\delta\partial_\lambda \phi\right) \\ &= \int d⁴ x \left( \frac{1}{2} \partial _\mu \partial ^\mu \phi \ + m² \phi\right) \delta \phi \\ &= 0 \tag{3}\end{align}
the problem is this equation will give me the KG equation with a wrong factor $1/2$.
Can someone say where my mistake is?