fix rows counting