reorgranize debug_mode