Fixed a bug in perfect load balancing that could wrongly cause empty grids