(Reuters) - Kraft Heinz Co KHC.O will spend more on marketing for key brands widely thought to have been neglected after reporting on Thursday that lower costs helped it beat third-quarter profit expectations, sending shares up 13% in midday trading.

FILE PHOTO: Heinz tomato Ketchup is show on display during a preview of a new Walmart Super Center prior to its opening in Compton, California, U.S., January 10, 2017. REUTERS/Mike Blake/File Photo

Having booked billions of dollars in writedowns this year on the value of some of its most well-known brands, including bacon and cold-cuts maker Oscar Mayer, Kraft Heinz has been criticized for gutting spending on brands under a chief executive installed by No. 2 investor, Brazilian private equity firm 3G Capital.

The company, whose biggest investor is billionaire Warren Buffett's Berkshire Hathaway BRKa.N, has reported 13 quarters of lackluster sales amid changing consumer tastes and competition from private-label brands owned by Walmart WMT.N, Costco COST.O and Kroger KR.N.

Newly appointed Chief Executive Miguel Patricio, who will outline a detailed plan after a strategic review of the business in 2020, said Kraft Heinz would now direct more marketing funds toward its flagship brands. The company, whose major brands include Heinz ketchup and Velveeta cheese, also said it plans to halve the number of project launches planned for 2020.

“While we have been working hard to finish the year in a much better place than we started, we have also been investing a lot of energy in our future,” Patricio said on a post-earnings call.

Shares of Chicago-based Kraft Heinz were up 13% at $32.23 in midday trading. Earnings excluding items fell 9.2% to 69 cents per share, but handily beat the 54 cents expected by analysts, according to IBES data from Refinitiv.

Given the disappointing news earlier this year on weak sales and brand writedowns, and a massive drop in the stock’s valuation since February, the results are encouraging for investors who had been concerned about the company’s future, Bernstein analyst Alexia Howard said.

Kraft Heinz’s earnings beat comes after a rough year that saw it slash dividends and scrap its full-year forecast after taking two major writedowns - one in February of $15.4 billion and another in August of $1.22 billion. The company’s procurement practices are also under investigation by the U.S. Securities and Exchange Commission.

The stock has tumbled about 40% since the company disclosed the probe and its first writedown in February.

Net sales fell nearly 5% to $6.08 billion, missing analysts’ estimates of $6.13 billion. The company said it expects fourth-quarter sales and EBITDA to be “generally similar” to those of the third quarter. Fourth-quarter earnings are expected to take a hit of up to 10 cents per share.

Expenses sank nearly 25% to $767 million in the third quarter ended Sept. 28 as supply chain cost inflation slowed compared to the first half of the year. The company raised product prices by 1% while sales volume fell 2.1 percentage points.