Improve debug mode