implemented reconnect