Fix a whole bunch of dependancy bugs and make it actually work when the size is not a multiple of eight.
Fix a whole bunch of dependancy bugs and make it actually work when the
size is not a multiple of eight.

jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase