add debug code
fix the reconnecting issue