Workers’ confidence in their written retirement plans surged before the depths of the recent market downturn, according to a survey released jointly Tuesday by Wells Fargo Advisors and Gallup.

The number of workers highly confident their written retirement plans would help them reach financial goals climbed to 45 percent in August, compared to 37 percent in May, according to the Wells Fargo/Gallup Investor and Retirement Optimism Index.

During that quarter, overall investor confidence went in different directions for workers and retirees. Worker confidence in the investment climate shrunk to 53 percent from 70 percent, while retirees seeing the markets favorably rose to 70 percent from 67 percent.

Optimism by all investors for the next 12 months stayed stable from May to August at 49 percent.

With widespread speculation that interest rates could be raised by the Federal Reserve in the near future, 44 percent of investors said they would change their portfolios if this happens.

“The most common action investors anticipate making is buying more stocks (30 percent), while just 8 percent said they would reduce their stock holdings. About a quarter (23 percent) said they would buy bonds or other fixed-income investments, whereas 10 percent said they would sell these types of instruments,” the survey reported.

The research was based on a survey of 1,006 U.S. investors in August.