Harry Potter worked up his magic this autumn and helped Barnes & Noble bks avoid a sales debacle, sending the bookseller’s shares up 10% on Tuesday.

The No. 1 bookstore chain notched another quarterly comparable sales decline in the second quarter, when they fell 3.2%, as fewer shoppers came into its stores. But things would have been much worse were it not for the release of Harry Potter and the Cursed Child, the script of a new play partly based on a story by Potterworld creator J.K. Rowling. More than 3.3 million copies of the script have been sold.

Just as he did in August, B&N CEO Leonard Riggio blamed election angst for the overall slow sales, but expressed hope the worst is over despite the continuing intensity of coverage related to President-elect Donald Trump’s victory.

“We did experience sluggish sales, which we believe are directly related to the election cycle,” said Riggio, the founder, chairman, top shareholder and former CEO who returned to the company’s helm this summer after it fired a CEO after only 11 months. “With the election behind us, we hope and expect sales will improve over the holidays.”

Despite that optimism, Barnes & Noble still expects comparable sales to be down by a low-single digit percentage for the fiscal year ending in April.

 

The bookseller is trying to find its footing again, trying out food and wine sales at some stores and relaunching its web site. The company lost hundreds of millions of dollars in the years since it launched the Nook e-reader devices in a valiant, though ultimately quixotic, attempt to compete with Amazon.com’s amzn Kindle, and is now focused on its core bookselling business and its stores. Sales of its Nook e-readers, including digital content and accessories, declined 19% in the period.

 

For the quarter ended Oct. 29, Barnes & Noble reported a loss of $20.4 million, or 29 cents a share, about half as bad as the year-earlier loss of $39.2 million, or 52 cents a share, in the year-ago period, and less than Wall Street expected. Total sales fell 4% to $858.5 million.