silence some unused variable warnings and move some debug code to only execute in debug mode