I am trying to solve
$$ PDE: - \frac{\partial f}{\partial t} + x \frac{\partial f}{\partial x} = x \\ IC : f(t_{max},x) = h(x) $$ using the method of characteristics. I attempted to follow the usual steps. First, parametrize the initial condition $$ (t,x) \rightarrow (s, \tau), t=t_{max}, s=0, x=\tau, f(0,\tau) = h(\tau) $$ Second, convert the PDE to the system of ODEs by taking $$ \frac{\mathrm{d}f}{\mathrm{d}s} = \frac{\partial f}{\partial t} \frac{\mathrm{d} t }{\mathrm{d} s} + \frac{\partial f}{\partial x} \frac{\mathrm{d} x }{\mathrm{d} s} $$ and identify the ODEs to be $$ \frac{\mathrm{d} t }{\mathrm{d} s} = -1, \hspace{3pt} \frac{\mathrm{d} x }{\mathrm{d} s} = x, \hspace{3pt} \frac{\mathrm{d}f}{\mathrm{d}s} = x $$ Third, solve the ODEs using the parametrized initial conditions $$ t = -s + \psi(\tau) \implies t = -s + t_{max} \\ \ln(x) = s + \psi(\tau) \implies x = \tau e^s \\ f = \tau e^s + \psi(\tau) \implies f(s,\tau) = \tau e^s - \tau + h(\tau) $$ Lastly, go back to the original coordinates via $$ s = t - t_{max}, \hspace{3pt} \tau = x \exp\left(-(t-t_{max})\right) \\ f(t,x) = x \exp\left(-(t-t_{max})\right) \exp(t - t_{max}) - x \exp\left(-(t-t_{max})\right) + h(x \exp\left(-(t-t_{max})\right)) \implies \\ f(t,x) = x \left[1 - \exp(-(t-t_{max})\right] + h(x \exp\left(-(t-t_{max})\right)) $$ Inserting $t=t_{max}$ in this solution does result in the initial condition of $h(x)$. However, setting the initial condition to be $h(x)=x^2$, taking the derivatives w.r.t. $t$ and $x$ of the found solution and introducing them back into the original PDE does not result in a correct equality.
Thus, my question is how do I correctly solve this PDE using the method of characteristics (or some other method such as eigenfunction expansion)?