minor changes and optimization
fix reconnect bug