Relativity Media has reached an agreement with its unsecured creditors, clearing a significant obstacle to getting approval for a bankruptcy sale.

Under the agreement, the creditors and their attorneys will receive up to $3.1 million. That is better than nothing, which is what they were expected to get when the bankruptcy case was initially filed in May. The creditors include law firms, guilds, and several former Relativity employees.

Attorneys announced the agreement Thursday in bankruptcy court in the Southern District of New York. The deal must still be approved by the judge.

Relativity declared bankruptcy for the second time in three years on May 3, and announced a proposed sale to its largest secured creditor, UltraV Holdings. UltraV has bid $40 million worth of its debt to take control of the moribund studio. At the time of the filing, Relativity also listed approximately $70 million in unsecured debt to 50 creditors.

Under the agreement announced Tuesday, the unsecured creditors will get $400,000 from UltraV. Their attorneys and other professionals will be paid $700,000. Relativity is also fighting with Netflix, with the streaming giant alleging that Relativity has breached their agreement. Under the settlement, the creditors will get $1 million out of any settlement with Netflix. After another $1 million goes to UltraV, the creditors will get an additional sum between $250,000 and $1 million.

Under the deal, the creditors are free to pursue Relativity founder Ryan Kavanaugh for additional recovery. The U.S. trustee’s office has raised concerns about $2.6 million that Kavanaugh received from the company in 2016, while the company still owed fees from its first bankruptcy. The U.S. trustee’s office is listed as an unsecured creditor on the second bankruptcy, in the amount of $1.3 million.

A hearing on the sale to UltraV is set for July 24.