I'm reading an algorithm proof in which there is a passage I can't understand. Substantially we have 2 statistically independent random arrays $X$ and $Z$, and a third random array $Y$. It's known that $Y=XZ$ and $E[Z] = 1$. What the author provides are textually the following passages: \begin{align} VAR[Y] &= E[(Y -E[Y])^2]\\ &= E[(X(Z-1) + (X-E[X]))^2]\\ &= (VAR[X]+E[X^2])VAR[Z]+VAR[X] \end{align} where $E[X]$ and $VAR[X]$ are the expected value (i.e. mean) and the variance of $X$, respectively.
Trying to understand that proof, I'm getting a different result, as it is: \begin{align} VAR[Y] &= E[(Y -E[Y])^2]\\ &= E[(XZ - E[XZ])^2]\\ &= E[(XZ -X +X -E[X])^2]\\ &= E[(X(Z-1) + (X-E[X]))^2]\\ &= E[X^2(Z-1)^2 + (X - E[X])^2 + 2X(Z-1)(X - E[X])]\\ &= E[X^2]E[(Z-1)^2] + VAR[X] + 2E[X(Z-1)(X - E[X])]\quad \text{(then, as $E[Z] = 1$)}\\ &= E[X^2]VAR[Z] + VAR[X] + 2E[X^2Z - ZXE[X] - X^2 + XE[X]]\\ &= E[X^2]VAR[Z] + VAR[X] + 2E[X^2Z] - 2E[ZXE[X]] - 2E[X^2] + 2E[XE[X]]]\\ &= E[X^2]VAR[Z] + VAR[X] + 2E[X^2]E[Z] - 2E[XE[X]]E[Z] - 2E[X^2] + 2E[XE[X]]]\\ &= E[X^2]VAR[Z] + VAR[X] + 2E[X^2] - 2E[XE[X]] - 2E[X^2] + 2E[XE[X]]]\\ &= E[X^2]VAR[Z] + VAR[X] \neq (VAR[X]+E[X^2])VAR[Z]+VAR[X] \end{align}
Can you help me to understand where am I wrong? Thank you very much in advance for your attention.
EDIT: This is the original author proof