Added rows count check