Changed nb_rows to reflect the amount of rows in the current column instead of zero. Fixes overlapping legend boxes that may fit in the same column.