some changes to debug logging