How does the product rule work for a double derivative, $\frac{\partial^2 }{\partial x^2}$? I have this function $$A_x=A_0\frac{1}{1+e^{-az}}e^{ik(z-ct)}$$ where $A_0$ is a constant and $a$ and $k$ are constants with dimensions of inverse length and $z \in \mathbb{R}$
I wish to compute $$\frac{\partial^2 A_x}{\partial z^2}$$

So my attempt is 
$$\frac{\partial^2 A_x}{\partial z^2}=A_0\left[\frac{\partial^2}{\partial z^2} \left(\frac{1}{1+e^{-az}}\right)-\frac{k^2}{1+e^{-az}}\right]e^{ik\left(z-ct \right)}$$
where I have simply applied the product rule for differentiation making the assumption that it works for double derivatives.
The reason why I have done it this way is to simplify the calculation further by using the following result: 
$$\frac{\partial^2}{\partial z^2}\left(\frac{1}{1+e^{-az}}\right)=a^2\frac{e^{-az}\left(e^{-az}-1\right)}{\left(1+e^{-az}\right)^3}$$

The problem, however, is that the correct answer is 
$$\frac{\partial^2 A_x}{\partial z^2}=A_0\left[\frac{\partial^2}{\partial z^2} \left(\frac{1}{1+e^{-az}}\right)+\color{blue}{2ik\frac{\partial}{\partial z}\left(\frac{1}{1+e^{-az}}\right)}-\frac{k^2}{1+e^{-az}}\right]e^{ik\left(z-ct \right)}$$
My answer is identical with the exception of the blue term, I don't understand where this term comes from and I know that my answer is wrong, but I would like to know where this term comes from and hence why the product rule does not apply to double derivatives?

The product rule is slightly different for double derivatives. For simplicity, let $f$ and $g$ be twice continuously differentiable functions of $x$. Then,
$$\frac{d^2}{dx^2}fg = \frac{d}{dx}\left(\frac{d}{dx}fg\right) = \frac{d}{dx}\left(f'g + fg'\right) = \frac{d}{dx}f'g + \frac{d}{dx}fg' = f''g + f'g' + f'g' + fg'' = f''g + \mathbf{2f'g'} + fg''.$$
The bold term corresponds to the blue term missing from your answer.
By the way, you can extend this to higher order derivatives in the same way. You end up with,
$$\frac{d^n}{dx^n}fg = \sum_{k=0}^n \binom{n}{k}f^{(n-k)}g^{(k)}.$$
edit: fixed typo
