Serbia and Croatia agreed Friday to ease the flow of migrants over the border between the countries after thousands of people, including children, were forced to spend the night out in the open in near-freezing temperatures along a muddy border passage.

The interior ministers of Serbia and Croatia said they will start shipping migrants by train directly from Serbia to Croatia so that they won't have to cross on foot, often treading kilometers in rain and cold weather, as has been the case so far. Migrants will register when they enter Serbia and will be able to cross into Croatia without any delays, which should speed up the process significantly, the ministers said.

"We have agreed to stop this torture," said Croatian Interior Minister Ranko Ostojic. "There will be no more rain and snow, they will go directly from camp to camp."

Further west, thousands of migrants aiming to reach northern Europe walked out of refugee camps on the border between Slovenia and Austria on their own, frustrated after waiting long hours in overcrowded facilities.

Eager to move on, thousands spread around along railway tracks, highways and mountain roads. Confused and unaware which roads to take to go west, some migrants also later turned back and returned to the refugee camps to wait for bus transport to other locations.

Tensions have been building among the migrants after the so-called Balkan route shifted. Migrants still cross first from Greece into Macedonia and then Serbia, but now go via Croatia and Slovenia instead of Hungary, which has erected fences along its borders with Serbia and Croatia.

Slovenian Prime Minister Miro Cerar said late on Thursday that his country has asked the European Commission for 60 million euros ($68 million) over six months after nearly 50,000 people entered the country. Cerar said Slovenia also requested police gear and personnel from the EU, although several countries already have offered to send police to assist Slovenia's stretched force.

Slovenia and Croatia have traded barbs since the start of the crisis, accusing one another of mistreating and mishandling the crisis. Slovenia initially said it could take in only 2,500 people a day and accused Croatia of dropping migrants uncontrollably at its doorstep.

Long hours in lines and overcrowded camps have led to several incidents in the past days, including scuffles, a stabbing and a fire in one of the migrant camps in Slovenia.

At the Serbian border, some 5,000 people gathered around fires, under tents and wrapped in blankets as they waited all night to cross into Croatia. Ministers said registration of refugees must speed up so that there are no delays in the transfer of migrants toward Western Europe.

Serbian minister Nebojsa Stefanovic said the two countries will ask the EU to recognize the Serbian registration process — which includes finger and palm-printing and biometric passes — so that migrants don't have to undergo the same procedure over and over again.

"With the winter coming, it is important to agree on a speedy flow of these people," Stefanovic said.

EU officials have called a summit for Sunday of several EU and Balkan leaders to focus on the migrant crisis.