better reconnection handling