fixed up the database expanding code, still working on some warnings this introduced
Fixed all the warnings about pointer math with void*