NEW YORK - It was a choppy ride for the stock market Monday that ended with major indexes closing mostly higher.

Traders were pulled in multiple directions. Stocks opened higher, fell in the afternoon, then rose again in the last hour of trading.

Bank stocks fell after Bank of America said a financial error would force it to cancel its stock buyback plan and dividend increase, while health-care stocks rose after U.S. drug giant Pfizer renewed its pursuit of a merger with British rival AstraZeneca. Formerly high-flying technology stocks fell again, dragging the Nasdaq composite index into the red.

The Standard & Poor's 500 index rose 6.03 points, or 0.32 percent, to close at 1,869.43. The Dow Jones industrial average rose 87.28 points, or 0.53 percent, to 16,448.74 and the Nasdaq edged down 1.16 points, or 0.03 percent, to 4,074.40. The Nasdaq erased most of a 61-point loss.

Bank of America sank $1, or 6.3 percent, to $14.95 after it unexpectedly announced it would suspend its stock buyback program and dividend increase. The bank discovered an error in how it calculates its capital ratio, a crucial measure of a bank's financial strength.

High-risk technology stocks showed ongoing weakness as investors continue to cut their exposure to high-growth names and turn their focus to larger dividend-paying companies. Amazon fell $7.25, or 2.5 percent, to $296.58 after falling 10 percent on Friday. Netflix lost $7.87, or 2.4 percent, to $314.21 and Facebook fell $1.57, or 2.7 percent, to $56.14.

In contrast, "old" technology companies such as Microsoft, Apple and IBM, which have more mature businesses and pay quarterly dividends, rose 2 percent or more Monday.

Health-care stocks did well after Pfizer renewed its push to buy AstraZeneca. AstraZeneca jumped $8.35, or 12 percent, to $77.01. Pfizer rose $1.29, or 4.2 percent, to $32.04.

In other markets, bond prices fell, pushing the yield of the 10-year U.S. Treasury note up to 2.70 percent from 2.66 percent Friday. Gold was little changed at $1,299 an ounce.