fixed code of debug mode.