Improved debug logging.