implemented a global debug switch