Prime Minister Boris Johnson has amended a controversial bill that seeks to override part of the UK’s EU withdrawal agreement in a move that should ensure parliament passes the bill next week.

Johnson insisted on proceeding with the Internal Market Bill despite warnings from critics, including many MPs in his Conservative party, that superseding the agreement could break international law and erode trust with the EU and other parters.

But two leading Conservative rebels issued an unusual joint statement on Wednesday with Downing Street, the prime minister’s office, saying the government had agreed to table an amendment to the bill following “constructive talks”.

Johnson wants to create a legal “safety net” giving him the power to override a provision in the withdrawal agreement that would impose different post-Brexit customs rules on Northern Ireland from the rest of the United Kingdom.

The provision seeks to prevent the creation of border checks between Northern Ireland, which is leaving the EU as part of the United Kingdom, and EU-member the Republic of Ireland.

The government’s amendment to the Internal Market Bill would require lawmakers to debate and vote on any plan to override the Northern Ireland provision.

“This will provide people and businesses with the certainty that they need,” the joint statement said.

Ed Miliband, the opposition Labour party’s shadow business secretary, said the proposed amendment “does not fix the problem of breaking the law (and) damaging (Britain’s) reputation around the world.”

“We need a (post-Brexit) trade deal with Europe and that is what we were promised,” Miliband tweeted.