Fixed bug with wrong row count