fix a bug related to failing pack/send
more robust debug support in error cases