Consider a Lagrangian $L(x,\dot x,t)$ and a corresponding Hamiltonian $H=\dot xp-L$ where $p=\partial L/\partial \dot x$ which satisfies Hamilton's equations $$\frac{\partial H}{\partial x}=-\dot p$$ $$\frac{\partial H}{\partial p}=\dot x.$$ I'm trying to show that Hamilton's equations are unchanged by a gauge transformation of the Lagrangian $L'=L+ \frac{dF}{dt}$ where $F(x,t)$ is a function of the position and time only. I first expand the derivative of $F$ $$\frac{dF}{dt}=\frac{\partial F}{\partial t}+ \frac{\partial F}{\partial x}\dot x$$ the new conjugate momentum is $$p'=\frac{\partial L'}{\partial \dot x}=\frac{\partial L}{\partial \dot x}+\frac{\partial}{\partial \dot x} \frac{dF}{dt}=p+ \frac{\partial F}{\partial x}$$ and so $$\frac{\partial}{\partial p'}= \frac{\partial p}{\partial p'} \frac{\partial}{\partial p}=\frac{\partial}{\partial p}$$ The new Hamiltonian is $$H'=p'\dot x-L' = p \dot x-L+\frac{\partial F}{\partial x} \dot x - \frac{dF}{dt}=H- \frac{\partial F}{\partial t}$$ Hamilton's equations are then $$\frac{\partial H'}{\partial p'}=\frac{\partial H}{\partial p}- \frac{\partial}{\partial p} \frac{\partial F}{\partial t}=\dot x-0=\dot x$$ and $$\frac{\partial H'}{\partial x}=\frac{\partial H}{\partial x}- \frac{\partial}{\partial x} \frac{\partial F}{\partial t}= -\dot p-\frac{\partial }{\partial t} \frac{\partial F}{\partial x}$$ It is this last equation where I'm having trouble. To satisfy Hamilton's equations, the right side should be equal to $\dot p'= \frac{d}{dt}(p+\frac{\partial F}{\partial x})$ however I end up with a partial derivative on the last term rather than a total derivative as it should be. How can one justify this as satisfying Hamilton's equations?
Edit
It seems that the error is arising when taking the partial of $H'$. When applying $\partial/\partial x$ to $H'(x,p')$ we are implicitly holding $p'$ constant, where as $\partial H/\partial x=- \dot p$ is true only when we are holding $p$ constant, not $p'$. A workaround is to use the form $H'=p' \dot x-L'$ as the functional dependence is clear. Then $$\frac{\partial H'}{\partial x}= -\frac{\partial L'}{\partial x} = -\frac{\partial L}{\partial x}- \frac{\partial}{\partial x} \frac{d F}{dt}= -\frac{d}{dt} \left( \frac{\partial L}{\partial \dot x} + \frac{\partial F}{\partial x}\right) = -\dot p'$$ where Euler-Lagrange was used on the second last equality. I'm still unsure of how to apply the chain rule to my original expression to get the correct result.