Attempt to sort out debug log fail; doesn't work, needs valgrind :/