Add missing include needed for older kernels.
Move some variables so they don't cause a warning when using a pre 3.8 kernel.