Lyft’s natural state in the US is to be trailing Uber. But a few months ago the pink-mustachioed company appeared ahead on one crucial count.

In January, Lyft reached a preliminary settlement agreement in a class action lawsuit over whether its drivers were independent contractors or employees. The deal awarded $12.25 million to drivers, the plaintiffs in the case, of which 30% was set aside for attorneys’ fees. It called for Lyft to make some changes in how it interacts with drivers, but ultimately sidestepped the employment classification matter.

But on Thursday, the judge in the case declared the agreement “glaringly” inadequate and threw it out. His argument: The attorneys on both sides did their math wrong, and the drivers got screwed.

“The settlement agreement does not fall within the range of reasonableness,” US district judge Vince Chhabria wrote. “The lawyers estimated the value of the reimbursement claim to be $64 million, when in fact, using their own methodology, it is worth more than $126 million. The drivers were therefore shortchanged by half on their reimbursement claim alone.”

The first point to understand is that Lyft has always assumed its drivers are contractors, not employees. This matters because contractors are responsible for their own costs of doing business—in this case, things like gas, insurance, vehicle maintenance, and so on—whereas companies are expected to reimburse those expenses for employees.

While the Lyft settlement didn’t rule on which category drivers fall in, the proposed $12.25 million deal was, essentially, an estimate of how much drivers had been shortchanged by working as contractors rather than employees. Per that agreement, drivers in the class would have collected an average of $53.02 from the settlement if they were considered “part time” (meaning they usually worked less than 30 hours per week for Lyft) and $676.19 if they were “full time” (meaning they usually worked 30 hours or more).

To calculate how much Lyft drivers were owed, their lawyer, Shannon Liss-Riordan, used something called the IRS mileage reimbursement rate—basically, how much the IRS suggests employers reimburse their workers for each mile they drive on business. In 2015, the rate was 57.5 cents per mile; this year it is $0.54. Liss-Riordan multiplied some version of that rate by the approximate number of miles drivers covered for Lyft during the “class period.” She defined this period as from May 2012, when Lyft got started in California, until June 2015. The resulting “maximum recovery” figure for mileage reimbursement was $64 million, from which Liss-Riordan through various legal assumptions determined a realistic settlement would be $12.25 million.

This is where judge Chhabria disagrees. “The class period does not end at June 2015,” he writes. “It proceeds through the date that the settlement receives preliminary approval.”

That might seem like a technicality, but it’s actually a big deal because of how rapidly Lyft grew over the last nine months. Between June 2015 and Feb. 14, 2016—a somewhat arbitrary date ahead of the preliminary approval hearing that Chhabria sets as a benchmark—the number of miles driven by Lyft drivers roughly doubled from the original “class period” estimate. That’s good for Lyft in terms of business on the whole. For the settlement, though, it’s bad news, because the judge now says that maximum reimbursement claim value should have been $126 million.

Lyft and the plaintiffs now have until May to negotiate a new settlement agreement using March 24 (the date of the preliminary approval hearing for the old deal) as the class period end. If they fail to reach a new agreement, the case will continue apace toward trial—presumably something Lyft would like to avoid, as it would reopen the possibility that a jury could find drivers to have been misclassified as independent contractors.

Despite the complexity, you can’t help but appreciate the irony. Just when Lyft thought this lawsuit—arguably the biggest legal challenge to its business—had been tucked away, those efforts were derailed by its own growth.