President-elect Donald Trump is singing the praises of Carrier Corporation after brokering an agreement with the company to keep 800 domestic factory jobs that were slated to go to Mexico.

The deal was a significant political win for Trump, suggesting he could bend the air conditioner and furnace manufacturer to his will after vowing to make an example of the company on the campaign trail.

But it also represented a reversal of fortune. Trump was less successful when he sued Carrier over a malfunctioning air-cooling system at the Trump International Hotel in New York City.

In an October 2007 decision, federal judge Shira Scheindlin ― whom Trump maligned in the first presidential debate as a “very anti-police judge” for halting New York City’s stop-and-frisk policy ― handed Carrier a partial victory in its quest to fend off Trump’s legal challenge, granting its request to dismiss Trump’s negligence claim but denying its requests to dismiss breach of warranty and breach of contract claims.

Later that year, the company settled with Trump on the claims the judge upheld.

The chiller unit malfunctioned when a hotel employee turned it on without realizing that a valve providing pressurized water to the unit was closed. As a result, water inside the cooling tubes could not be “flushed out,” Scheindlin wrote, causing it to freeze and fracture the tubes.

Although the hotel conceded the error and disciplined the employee, it also blamed Carrier for “improperly servicing and disabling a separate low pressure differential flow switch which is designed to prevent a freeze-up when there is no water flowing throughout the chiller,” Scheindlin wrote.

The hotel argued that its negligence claim was not subject to the “economic loss” rule, a provision of New York law that would have precluded it from seeking damages. To convince Scheindlin that the rule didn’t apply, the hotel’s lawyers had to demonstrate that the malfunctioning switch had damaged “other property.” So they argued that the “other property” included other parts of the chiller unit.

Scheindlin didn’t buy it.

“I conclude that the absorption chiller and all of its safety controls, including the pressure differential flow switch, are one integrated unit,” she wrote. “Thus, I find that the pressure differential flow switch did not damage ‘other property’ when it malfunctioned and caused the absorption chiller to freeze. As a result, Trump’s negligence claim is dismissed.”

Neither the Trump transition team, nor Carrier, immediately responded to a request for comment on the lawsuit.

In the wake of the lawsuit, properly functioning hotel air conditioning appears to have become something of a fixation for Trump.

Speaking at a campaign rally at the Hotel Roanoke in Roanoke, Virginia, in July, Trump complained about the heat and accused the hotel of turning down the air conditioning to save money.

“They turn the air conditioning down because they save money, so then I would not pay them,” Trump said, visibly perspiring. “You oughta try turning on the air conditioning, or we’re not going to get you paid.”