Fixed bug causing error trown when small amount of builings were assigned to an agent