There’s an order to these things: Defendants in the U.S. must be found guilty before they’re punished. But a celebrity’s case overseas demonstrates the order is often reversed, elsewhere, and even here.

American rapper A$AP Rocky is now free, after previously being indefinitely detained before trial in Sweden. Unlike A$AP Rocky, thousands of Americans are in the same position in our own jails but won’t get the president or a celebrity to call for their freedom. Even if they beat the rap, they cannot recover the time they lost behind bars. Moreover, those locked up until adjudication are often fired from their jobs and evicted from their apartments, destabilizing their lives in ways that increase the odds of re-arrest for many defendants.

Rocky, whose real name is Rakim Mayers, was held on charges connected with an altercation on the streets of Stockholm. It is unclear exactly what transpired, but a judge ordered him detained as a flight risk before he was freed on Friday.

While the Department of State and President Trump went to bat for Rocky, we must not lose sight of reforming pretrial detention at home. There are nearly half a million Americans in pretrial detention on any given day. Some 62% of those in U.S. jails are pretrial detainees, and the pretrial population grew 433% from 1970 to 2015.

Many of the 12 million Americans admitted to jail every year are released within 24 hours, whether through a simple promise to appear, posting money bail, or pretrial supervision. However, others stay far longer, often because they cannot afford bail, not because they are determined to be too dangerous.

In Mississippi, where more than one third of pretrial detainees are kept 90 days or more, Jerry Sanders sat in jail for more than a year in 2018 while drug possession charges were pending. This was longer than the maximum sentence would be for such a charge. From 1983 to 2013, the last year for which national data is available, the average length of stay in U.S. jails grew from 14 to 23 days.

Beyond the numbers, a system that routinely administers the brunt of punishment prior to adjudication raises concerns about fairness and due process. Research has found that 46% of New York City defendants who did not make bail were not sentenced to incarceration—with about half never convicted and the other half receiving a non-custodial sentence such as probation. Nonetheless, pretrial incarceration substantially increases the chance that the defendant, even if actually innocent, will plead guilty. When pretrial defendants are in jail prior to trial, their lives are turned upside down and their ability to marshal a defense is compromised. Thus, pleading guilty in exchange for time served in misdemeanor cases can be less daunting than waiting months or years for a trial.

Of course, some might argue these drawbacks, as well as the $13.6 billioncost to taxpayers, are necessary to ensure public safety. Indeed, pretrial detention is warranted in a small number of cases.

In an ideal system, prolonged pretrial detention would require clear and convincing evidence of guilt, would never be tied to ability to pay, and would only result from an appealable court determination that a defendant charged with a serious violent or sex offense is too risky to be released under any set of conditions. In 2018, New Jersey implemented an approach that moves in this direction, including a constitutional amendment allowing for denial of bail in certain cases.

In the past, courts would set a very high bail amount hoping the defendant could not post it. But occasionally there are wealthy defendants charged with serious offenses who pose a high risk going forward. While judges can still set financial conditions of release, they now do so in only a handful of cases, relying instead on pretrial supervision when an assessment indicates monitoring is warranted.

report by New Jersey State Courts found pretrial detention dropped in the first year by a third while rates of re-appearance and re-arrest have remained stable. Since this pretrial overhaul, crime has continued its sharp decline. Court officials believe even better results can be achieved going forward through the expansion of text reminders of court dates to all defendants. Research shows many instances of defendants failing to appear result from simply forgetting about hearings, and that text reminders reduce failures to appear by 26%.

Thankfully, the latest verse in A$AP Rocky’s case is about his freedom. Let’s hope that his endurance of injustice thousands of miles away serves as a reminder of our own pretrial justice challenges here at home.