United Airlines said Thursday that its net income in the second quarter hit $789 million, topping Wall Street expectations and marking a turnaround from the first quarter when United was the only major U.S. carrier to report a loss. The company also said that it will buy back up to $1 billion in shares over the next three years. United has struggled to overcome technology glitches and other problems since the 2010 merger of United and Continental. The Illinois-based airline lost $609 million in the first quarter as it suffered through 35,000 weather-related flight cancellations. American, Delta, and Southwest were posting strong results at the same time. In the second quarter, so-called ancillary revenue – extra fees for things like checked bags and roomier seats – rose 8 percent per passenger. United said that excluding special items, it would have earned $2.34 per share in the April-to-June quarter. Analysts surveyed by FactSet were expecting $2.19 per share. Revenue rose 3.3 percent to $10.33 billion, slightly higher than Wall Street forecasts. Fuel and labor costs each grew roughly 1 percent.