fixed bug in flat loader initial agent building loop