change row.length method to row.count