A Minnesota man spent months in jail on drug possession charges after police mistook a half-ounce bag of vitamin powder for drugs.

Police pulled over Joseph Ray Burrell, 31, outside of a Mankato, Minn., grocery store in November for driving without lights on, according to the Mankato Free Press.

A subsequent search of his car turned up a small bag of powder that police believed were illegal drugs. They conducted a field test, which came back positive for amphetamine and Burrell was charged with two felony counts of drug possession.

“I told the judge I couldn’t plead guilty to something I knew wasn’t a drug,” Burrell said, according to the Mankato Free Press. The judge set his bail at $250,000.

He stayed locked up for months while he waited for a more sophisticated drug test to clear his name.

According to Burrell, it took a month for prosecutors to send the powder to the Bureau of Criminal Apprehension crime lab for more advanced testing and more than a month passed before the results came back and nothing illegal was found in the powder.

On Feb. 4, Burrell was released– a day before he was scheduled to appear in court.

“I was furious, I was hot, I was pissed off. At the same time it was like, unbelievable,” he said, according to KMSP.

Burrell says that the vitamins were prescribed to him for shoulder pain. And despite his criminal history, he had recently left a drug treatment program right before the arrest.