debug logging improvement