Bug fixes

Fix bit width calculation to add 1 to logarithm, and correctly increment
num_rows when adding repeated data.