In order to derive the Black-Scholes equation for a stock $S(t)$ yielding dividends at the continuous rate $d$ $$ S(t) = S_0 e^{(\mu - d - \frac{\sigma^2}{2})t + \sigma \sqrt{t} N(0,1)} \text{,} $$ M. Joshi in The concepts and practice of mathematical finance starts from the stochastic process for a delivery contract $X(t) = e^{-d (T - t)} S(t)$, equation (5.76):
$$ dX_t = (\mu + d) X_t dt + \sigma X_t dW_t \qquad \qquad (1) $$
He defines a delivery contract $X_t$ as a contract where you pay for stock $S_t$ today, but it gets delivered to you at time $T$. He writes that for a non-dividend paying stock, $X_t$ at time $T$ has the same value of $S_t$ as both end up with you holding one $S_t$. Then he makes the case of a dividend paying stock (included in text snapshot below): at time $T$ you will have $e^{d(T−t)}S_t$ if you held the stock, while only $S_t$ if you held a delivery contract, so the latter's value at $T$ must be $X_t=e^{−d(T−t)}S_t$.
However equation (5.76), renamed (1) above is thrown there as is and not motivated by any derivation. I have tried deriving it from the $X_t$ and $S_t$ processes listed above, using the chain rule ($=$ Ito's lemma here because $\dfrac{\partial^2 X_t}{\partial S^2} = 0$):
$$ \begin{align} dX_t(S_t, t) & =\\ &= \frac{\partial X_t}{\partial S_t} dS_t + \left[ \frac{\partial X_t}{\partial t} + \frac{\partial X_t}{\partial S_t} \frac{\partial S_t}{\partial t} \right] dt \\ &= e^{-d(T - t)} \left[ ( \mu - d) S_t dt + \sigma S_t dW_t \right] + \left[ e^{-d (T - t)} S_t d + e^{-d (T - t)} S_t \left(\mu - d - \frac{\sigma^2}{2} \right)\right] dt \\ &= X_t \left[ \left( 2 \mu - d - \frac{\sigma^2}{2} \right) dt + \sigma dW_t \right] \qquad \qquad (2) \end{align} $$
where I have used $dS_t = (\mu - d) S_t dt + \sigma S_t dW_t$.
Equations (1) and (2) differ, in that they have different deterministic components.
Can anyone enlighten me as where errors/incongruities are in the above?
Below, the passage from the book included as snapshot.