add reconnection mechanism