add debug code for packet direction handling