Confusion regarding the finite square well for a negative potential Consider the finite square well, where we take the potential to be $$V(x)=\begin{cases}
-V_0  & \text{for}\,\, |x| \le a \\
\,\,\,\,\,0 & \text{for}\,\, |x|\gt a
\end{cases}$$ for a positive constant $V_0$. 
Within the square well the time-independent Schr${ö}$dinger equation has the form $$-\frac{\hbar^2}{2m}\frac{d^2 u}{dx^2}=(E-V)u=(E+V_0)u\tag{1}$$
While outside the square well the equation is
$$-\frac{\hbar^2}{2m}\frac{d^2 u}{dx^2}=Eu\tag{2}$$ with $E$ being the total energy of the wavefunction $u$ where $u=u(x)$. 
The graph of the potential function is shown below: 

Rearranging $(1)$ I find that 
$$\frac{d^2 u}{dx^2}=-\underbrace{\bbox[#FFA]{\frac{2m}{\hbar^2}(E+V_0)}}_{\bbox[#FFA]{=k^2}}u$$
$$\implies \frac{d^2 u}{dx^2}+k^2u=0\tag{3}$$ 
with 
$$k=\frac{\sqrt{2m(E+V_0)}}{\hbar}\tag{A}$$
So equation $(3)$ implies that there will be oscillatory solutions (sines/cosines) within the well.
Rearranging $(2)$ I find that 
$$\frac{d^2 u}{dx^2}=-\underbrace{\bbox[#AFA]{\frac{2m}{\hbar^2}E}}_{\bbox[#AFA]{=\gamma^2}}u$$
$$\implies\frac{d^2 u}{dx^2}+\gamma^2u=0\tag{4}$$
with
$$\gamma=\frac{\sqrt{2mE}}{\hbar}\tag{B}$$
But here is the problem: Equations $(4)$ and $(\mathrm{B})$ cannot be correct since I know that there must be an exponential fall-off outside the well. 
I used the same mathematics to derive $(4)$ & $(\mathrm{B})$ as $(3)$ & $(\mathrm{A})$. After an online search I found that the correct equations are
$$\fbox{$\frac{d^2 u}{dx^2}-\gamma^2u=0$}$$
and
$$\fbox{$\gamma=\frac{\sqrt{-2mE}}{\hbar}$}$$
Looks like I am missing something very simple. If someone could point out my error or give me any hints on how I can reach the boxed equations shown above it would be greatly appreciated.

EDIT:
One answer mentions that the reason for the sign error is due to the fact that $E\lt 0$ inside the well, so I have included a graph showing the total energy (which is always less than zero inside or outside the well):


EDIT #2:
In response to the comment below. If I place $E\lt 0$ in equation $(4)$ (outside the well) I will have to also make $E\lt 0$ in equation $(3)$ (as $E\lt 0$ inside the well also) and so equation $(3)$ will become $$\frac{d^2 u}{dx^2}-k^2u=0$$ which is clearly a contradiction as this no longer gives oscillatory solutions (plane waves) inside the well. 
 A: This is in principle correct. Take the limits For $E>0$ and $E<0$. If the latter obtains, you get a negative under your square root (and k becomes imaginary) and $e^{ikx}\rightarrow e^{-kx}$, giving you the exponential solution. My guess is that there is a different sign convention in what you read, where it is assumed explicitly that $E<0$. Likewise if $E>0$, then we expect to continue to get plane waves, and we do. Thus, as long as you remember that energy inside the well is negative you will always get the same results. 
A: You are just looking at the general solutions of Schroedinger equation inside and outside the well. In principle, however, you have to solve the eigenvalue problem to find the allowed energy eigenvalues E and wavefunctions for the whole system. For this, you have to use the boundary conditions at the well boundaries and at infinity to find the energy eigenvalues E and wave functions of the whole system. Equations (4) and (B) are correct, because you get the exponentially decaying wavefunctions outside the well only for an eigenvalue E<0 which corresponds to a bound state. When you assume E>0, you have propagating waves both inside and outside the well.
