fix calculation of numrows