AstraZeneca was dealt a blow earlier this week when a judge denied a temporary restraining order that would have blocked the approval of generic versions of its blockbuster cholesterol drug Crestor.

AstraZeneca believes the recent approval of Crestor to treat a rare pediatric illness should grant the company market exclusivity and that allowing generic versions of the medication would be unsafe because the generics would not have labeling information for use in children. The company filed a lawsuit against the FDA to prevent generic versions of the drug from flooding the market.

U.S. District Judge Randolph Moss denied the restraining order because he believed the company was unlikely to win a lawsuit claiming it is entitled to seven more years of exclusivity.

While the lawsuit is still pending, competitors will be allowed to bring their generic versions of the medication to market, which will effectively tank AstraZeneca’s profits. Last year, Crestor accounted for more than 20% of the company’s $23.6 billion in sales.

AstraZeneca’s move to block generics drew criticism from many, including Senator Bernie Sanders who wrote a letter to the FDA in early July urging the FDA not to allow AstraZeneca to exploit a “loophole” in current legislation. Sanders points out allowing generics onto the market will help provide millions of patients with lower-cost medications.

This summer has been tough for AstraZeneca. The Brexit vote has left uncertainty in the European market for medications and medical devices, and that could spell disaster for the UK-based company. To make matters worse, the Centers for Disease Control and Prevention (CDC) recently came out advising against AstraZeneca’s FluMist nasal spray vaccine saying it wasn’t as effective as traditional flu shots.

But it’s not just the short-term that has AstraZeneca worried. The company is coming under fire for dangerous side effects of its popular heartburn medication Nexium. Recent studies have linked the medication to chronic kidney injuries and kidney failure. Several lawsuits have been filed against the company over Nexium, and with millions of Americans taking Nexium everyday, it is likely lawsuits will grow astronomically over the next few years.