count rows
fixed main issues