U.S. Customs and Border Protection spent more than $5 million on polygraph examinations for applicants who were already disqualified before they were ever connected to a lie detector.

The Office of Inspector General for the Department of Homeland Security released its findings Thursday. The report said that over a four-year period between 2013 and 2016, about 2,300 applicants admitted during the application process to committing crimes such as illegal drug use, human trafficking and narcotics smuggling.

The applicants were then connected to polygraph exams at a cost of $2,200 per exam.

CBP pledged to stop exams as soon as someone admits to a crime. The country's largest immigration agency is currently rushing to hire 5,000 new agents.