Battle of Luceria

Intro
Consul M. Atilius led his army towards Luceria, that, he was told, was besieged by the Samnites. When he got near that city, he was stopped by a Samnite army. The battle begun. In this battle there are some things that don't really add up.

Defeated
When the first day had ended and the battle stopped, the Romans had many more losses than the enemy and were in fact defeated. They must have built their camp in the dark because, at least in the way Livius describes, the battle had begun before they had had the time to build it.

Low moral
Livius states, the moral in both camps was very low and the Samnites wanted to leave without further combat. They had chosen a stupid place for their camp, because the only way out was past the Roman camp. This doesn't make sense:

If they were blocking the way to Luceria, they could have marched that way back.

If they had been manoeuvred into that trap during the battle (very unlikely since they had had the upper hand, but lets suppose so) and wished to leave without fighting, they would have left in the dark

The corridor must have been very narrow, since when the Samnites eventually tried to retreat, theire own luggage was blocking their way, but there was room enough to deploy both armies (at least 1,5 km). If they had put it on one heap hey could easily move around the heap. If they had dropped their luggage while in battle order they could easily have walked through.

Why didn't the Romans leave during the night, if their moral was that low and they in fact had been defeated?

Circumvallation
But when the Samnites approached the Roman camp they were seen carrying stakes. The Romans concluded they had plans to make a circumvallation around the camp. The consul ordered the men to arm themselves and prepare for battle outside the camp.

Victory
In the battle that followed nobody was eager to fight, but in the end the Romans succeeded in defeating the Samnites, but paid a very high price.