Fix two issues when debug logging is on
Fix two issues when debug logging is on