Fixed rounding error with integer math

Fixed rounding error with integer math that did not calculate the number of rows correctly.