A hefty impairment charge at Wendy's ( WEN) led the fast-food chain to post a loss for its second quarter, but its adjusted profit and sales beat Wall Street's expectations. The No. 3 U.S. burger chain reported a loss of $29.1 million, or 25 cents a share, for the quarter. A year earlier, Wendy's recorded a profit of $70.8 million, or 61 cents a share. This year's results included a charge of $93 million related to a write-down on the value of Wendy's struggling burrito chain, Baja Fresh Mexican Grill. Excluding the charge, Wendy's earned $63.8 million, or 54 cents a share. Analysts, on average, were expecting earnings of 53 cents a share, before charges, according to Thomson First Call. The company's total revenue rose 8% from last year to $1.03 billion, while its same-store sales, or sales at restaurants open at least a year, were slightly positive -- the first quarterly increase in same-store sales in almost two years. Analysts had expected revenue of $999.2 million. "Excluding charges and costs for our restructuring initiatives, our core Wendy's business is improving," the company said in its earnings press release. "During the second quarter Wendy's produced the strongest same-store sales gains in the last seven quarters and food costs are improving. Wendy's July same-store sales trends are even stronger and are running about 3.5%." Tim Hortons ( THI), a Canadian doughnut chain that is 83% owned by Wendy's, reported earlier Thursday that its second-quarter earnings rose 25% while its revenue rose 10%. Wendy's expects to spin off the remainder of its stake in Tim Hortons on October 1. Wendy's has struggled in recent years under competitive pressure from McDonald's ( MCD) and Burger King ( BKC). After a series of proxy battles with activist shareholders, the company agreed to spin off Tim Hortons and take aggressive measures to shore up its market share and return value to shareholders. Shares of Wendy's closed down 33 cents, or 0.5%, to $59.67.