(Includes additional information from earnings conference call, updated stock quotes.)

Morgan Stanley's ( MS) second-quarter numbers look a lot worse than they are.

The bank reported a wider-than-expected loss Wednesday, due to an accounting oddity where improvement in its credit quality actually hurt its results.

The loss of $159 million, or $1.37 per share, was larger than the consensus estimates of 15 analysts polled by Thomson Reuters, who had foreseen a 49-cent loss. Morgan Stanley was also negatively impacted by paying back the federal government's $10 billion investment made through the Troubled Asset Relief Program, or TARP.

It is tempting to slap Morgan Stanley down for the quirks in their numbers. While its competitors Goldman Sachs ( GS) and JPMorgan Chase ( JPM) also took charges related to paying back TARP, they reported big second-quarter gains last week, and had no such debt-related quirks.

But the issue seems to have more to do with the fact that Morgan Stanley came closer to going out of business than Goldman or JPMorgan last year than anything to do with its current performance. CFO Colm Kelleher assured everyone on the company's earnings call Wednesday that Morgan Stanley will no longer be an outlier in this area.

"It's no longer an idiosyncratic issue for Morgan Stanley. We're in line with the pack," he said.

Putting that aside, then, and the fact that Morgan Stanley continues to look like a chump for taking on less risk than Goldman, there are reasons to be optimistic about the company's prospects. Investors agreed Wednesday, bidding the stock up a penny to $27.57 in recent trading.

Merrill Lynch Bank of America analyst Guy Moszkowski and Sandler O'Neill's Jeff Harte both point out that Morgan Stanley return on equity of roughly 13%, excluding these debt-related complications, is solid.

Morgan Stanley posted revenues of $5.4 billion, driven largely by credit trading and equity underwriting, as the bank helped other financial companies sell new equity to bolster their balance sheets. Analysts had expected slightly lower revenues of $5.35 billion.

And the bank recently hired a team of top flight bond traders led by veteran Jack DiMaio that should make it more competitive with Goldman in this critical area. It is hard to believe this team came cheaply, but DiMaio worked for CEO John Mack in the past at Credit Suisse ( CS), so presumably Mack knows what he's getting.

The results include one month's performance from its Morgan Stanley Smith Barney joint venture with Citigroup ( C), which closed May 31. The venture gave a 13% boost to Global Wealth Management revenues, though the bank says the gains were offset by "weaker market conditions." Morgan Stanley owns 51% of the combined unit.

On the call, analyst Mike Mayo of CLSA noted that net new assets in the unit are down 1% and that Morgan Stanley's existing wealth management unit is performing better than Smith Barney's. He asked Kelleher whether Morgan Stanley was suffering from "buyer's remorse."

Kelleher, of course, vigorously denied any second thoughts, saying it's too early to make any judgments.

"Remember these are two companies going at different speeds at different times when things came together, so I think you've just got to wait for things to settle down," Kelleher said.

It is indeed early, but mergers in general are problematic, and the fact that this one is a joint venture between two competitors can't make things easier. This will be an area to keep an eye on for potential problems.