Whenever investors rush to the exits, stocks of good companies tend to get trampled along with the bad. And there has been quite a stampede out of stocks since last October.

A number of companies didn't deserve the drubbing they took — and have competitive advantages that seem to have been overlooked because of the gloomy short-term outlook.

For example, McGraw-Hill (MHP) has been dragged into the middle of the subprime-mortgage mess through its ownership of bond-rating behemoth Standard & Poor's. S&P and other bond raters are under fire for vouching for the safety of complicated mortgage securities that later plummeted in value.

Critics say the root of the problem is a system in which those with the most to gain from a favorable rating — the bond issuers — are the ones paying for the ratings. Any reform of the system would have a major impact on S&P. Meanwhile, few new mortgage securities are being issued, and S&P's profits are suffering as a result.

But the chance that new laws or regulations would force bond raters to change their business models is small. And the status quo favors S&P, which rates $32 trillion worth of debt in more than 100 countries and has an unassailable position.

Concerns about S&P's near-term performance, however, are real. The financial-services firm accounts for 45 percent of McGraw-Hill's revenues and three-fourths of its operating profits. In March, McGraw-Hill, which is headquartered in New York City, warned that it wouldn't hit its 3 percent to 5 percent target for full-year earnings growth.

But while the uncertainty is unsettling, it should be put in perspective. S&P's business of rating new securities accounts for only some 15 percent of McGraw-Hill's total revenues, according to analyst Wendy Walker, of Argus Research. And the long-term outlook is solid. "There will always be new investment products that need to be rated," says Robert Millen, co-manager of Jensen fund, which owns McGraw-Hill shares.

S&P has other businesses, including research, data and the licensing of its stock-market indexes. McGraw-Hill is also a dominant player in textbooks, and its media division includes such well-known brands as BusinessWeek magazine and J.D. Power and Associates, which conducts customer-satisfaction surveys.

At a recent price of $40, McGraw-Hill shares sell for just 14 times this year's expected earnings, and they pay a dividend, currently at a rate of 88 cents a year, which has risen an average of 10 percent annually over the past 34 years (the stock yields 2.4 percent).

David Landis is a contributing editor to Kiplinger's Personal Finance magazine. Send your questions and comments to [email protected]