Improve debug logging