added setDebugMode(boolean mode)