Bww

Image source: Buffalo Wild Wings.

What happened: Shares of Buffalo Wild Wings (NASDAQ:BWLD) flew 24.8% higher in July, according to data from S&P Capital IQ. The restaurant chain's stock tracked above the broader market all month long, but only slightly. The big breakout fell near the end of July, when B-Dubs reported disappointing second-quarter results but also explained why the next few quarters will fare better. Moreover, even the soft second quarter had some strong numbers bubbling right below the surface.

Why it happened: For the second quarter, analysts were expecting earnings of $1.12 per share on $430 million in revenue. Instead, Buffalo Wild Wings' earnings rose 17% year over year to land at $426 million. Earnings declined 10% to $1.12 per share. That was the company's third consecutive earnings miss, and B-Dubs has not beaten revenue estimates since the second quarter of 2014.

On the upside, same-store sales in company-owned locations increased 4.2% year over year. Analysts would have settled for 3.7%. The restaurant industry often pays closer attention to this crucial figure than to the earnings and top-line sales that tend to motivate share-price swings in most other sectors. For franchisees, same-store sales only grew 2.5% larger, but that's less of a concern for the company itself since it collects largely the same franchising fees and royalties anyhow.

Moreover, management appears to have a solid plan in place for operational improvements.

Although we don't believe in timing the market or panicking over market movements, we do like to keep an eye on big changes -- just in case they're material to our investing thesis.

Buffalo Wild Wings is converting many of the location network's best performers from franchisees to company-owned, keeping a larger share of their all-star profits close to the vest. In the last 13 months, the company bought out a total of 108 franchise locations in high-performing markets. Forty-four of those buyouts fell in July, marking a big surge in this profit-boosting activity.

In the face of rising costs on food ingredients -- particularly on those crucial chicken wings -- as well as pricier employee benefits packages, Buffalo Wild Wings is investing in store remodelings and staff training programs. The idea is to keep customers satisfied enough to keep them coming back for more wings and beer, even if the company passes the buck to the customer when operating expenses surge.

Anders Bylund has no position in any stocks mentioned. He seriously considered buying some B-Dubs shares nine years ago, but never pulled the trigger. Bad move, that. The Motley Fool, on the other hand, both recommends and owns shares of Buffalo Wild Wings. Try any of our Foolish newsletter services free for 30 days.

We Fools may not all hold the same opinions, but we all believe that considering a diverse range of insights makes us better investors. The Motley Fool has a disclosure policy.