In chapter 1 problem 11 of Goldstein I'm asked to show that Lagrange's equations: $$\frac d {dt} \biggr(\frac {\partial T} {\partial \dot {q_j}} \biggr) - \frac {\partial T} {\partial {q_j}}=Q_j$$ can be written as:
$$\frac {\partial \dot T} {\partial \dot {q_j}} - 2\frac {\partial T} {\partial {q_j}}=Q_j.$$
All the solutions I've found start with the following 2 lines:
$$\dot T = \sum_i \frac {\partial T} {\partial q_i} \dot {q_i} +\sum_i \frac {\partial T} {\partial \dot {q_i}} \ddot {q_i} +\frac {\partial T} {\partial t}$$
$$\frac {\partial \dot T} {\partial \dot {q_j}} = \sum_i \frac {\partial T} {\partial q_i \partial \dot {q_j}} \dot {q_i} +\sum_i \frac {\partial T} {\partial \dot {q_i} \partial \dot {q_j}} \ddot {q_i} +\frac {\partial T} {\partial t} +\frac {\partial T} {\partial q_j}=\frac d {dt} \biggr(\frac {\partial T} {\partial \dot {q_j}} \biggr)+\frac {\partial T} {\partial q_j}$$ and move on from here.
My problem is that the $\ddot q_i$ are not being held constant when taking the partial derivative, they are functions of $\textbf q,\dot {\textbf {q}},t$, so the second line should include another term: $$\sum_i \frac {\partial T} {\partial \dot {q_i}} \frac {\partial \ddot {q_i}} {\partial \dot q_j},$$ which messes up the derivation. What am I missing here?