setup automatic reconnection