minor tweaks to debug logic