[Misc] Improve debug code