database.c: fixed memory mangling when reading with good old memcpy
database.c: clean up debug code