Fix reconnect logic for IE 9/10