fix the reconnecting issue

add debug code
fix the reconnecting issue