In the aftermath of the terrorist attack in San Bernardino on Dec. 2, lawmakers passed a powerful counter-terrorism bill amending the visa waiver program in the US. The new law, known as HR 158, attempts to address real threats posed by the Islamic State—but in the process, it’s unfairly branded journalists, humanitarian aid workers, business executives and refugees as terrorist risks.

The visa waiver program allows citizens in 38 countries, mostly in the European Union, to receive online travel authorization to visit the US without a visa for up to 90 days. But under the new law, any applicant who has been to Iran, Iraq, Syria or Sudan since 2011, or is a foreign national of those countries, is deemed a terrorist risk and thus ineligible for the waiver program. To enter the US, they must now apply for a visa and undergo an interview with US authorities.

The politicians who support this law say that it’s simply intended to prevent ISIL terrorists from entering the US. ISIL has indeed promised to infiltrate the US by sending members disguised as fake refugees or as fake defectors of the terrorist organization. Since 2014, it has created authentic Syrian and Iraqi passports to arm its members with new identities—sometimes to establish bank relationships for terrorist financing, but more often as fake refugees. Trying to weed out the fake refugees isn’t easy: the identity of a Syrian national cannot be verified, given the protracted war in Syria. The fake passport scheme is a serious international security threat—one the likes of which the world has never seen before.

However, many people have been unreasonably caught up in the net of HR 158. A journalist from London, Madrid, Brussels or Paris who travelled to Syria to report the conflict is classified as a terrorist risk under the law. So is a professor who travels to Iran to speak at a conference, and the countless humanitarian aid workers, doctors and lawyers who work in Syria, Iraq or the Sudan to provide emergency aid and schooling to victims of terrorism. And of course, the refugees trying desperately to escape terrorist regimes has just had possible escape routes made even more difficult for them to utilize.

HR 158 does have exemptions. But they are only for people who visited one of the four countries deemed to pose a terrorist risk on behalf of the government or the military.

The consequences of the law could be bleak. Treating humanitarian aid workers as a terrorist risk will make it harder to recruit them from countries participating in the visa waiver program, which could in turn impact programs aimed at helping civilians in the four countries. Children in conflict zones like Syria who live in poverty and are deprived of food and education are more likely to turn to terrorist groups. So we risk enlarging the pool of terrorists by making it harder for people in the Middle East to receive aid.

Another issue is the addition of Iran to the list of countries that pose an ISIL risk. Iranians have not joined the Islamic State, and nor is Iran a state of concern for radicalization or a transit country used by foreign fighters to join ISIL. Moreover, Iran is not a jurisdiction used by ISIL for terrorist financing. That’s because Iran is mostly a Shi’a country, and ISIL is a Sunni group that is anti-Shi’a. Iran is the last place on Earth that the leaders of the Islamic State would use to bank. And finally, Iran is fighting ISIL on the ground, and shares with the US the same goal of elimination.

So why were Iran and Iranian nationals added to HR 158? It seems likely that the real purpose may have been to delay the growing volume of trade between Iran and large corporations in EU countries. Business executives in the EU will be reluctant to visit Iran for trade if it means they will be flagged as a “terrorist risk” in government databases and prevented from visiting the US without a visa. That could help give American corporations equal access to the Iranian market.

Even if the goal was not to interfere with Iran’s ability to engage in trade with corporations in the EU, that is its result. And therein lies the biggest problem with HR 158. It violates the terms of the nuclear deal with Iran, which requires that the US not adopt discriminatory regulations or policies that adversely affect Iran’s ability to resume normal trade and economic relations, and imposes an obligation to ensure that Iran has access to trade, tech, energy and finance.

Given these issues, the US should move to amend the law so that it’s consistent with counter-terrorism policies. That means removing Iran and Iranian foreign nationals from the list, and creating exemptions for journalists, professionals and humanitarian aid workers. We should be supporting their efforts abroad—not making it harder for them to do their jobs.