improve debug mode