make callback debug statements a bit more robust