backport to v.4.4-patches of patch 3310250:

from fenner: misc fixes for debugging output of agentx