Fixing performance issue with large number of rows

This simple patch fixes the performance problem described in issue #4.

Thanks.