add debug mode (through a global variable)