fix flex calculation when items is <= perRow