Remove redundant counter variable in read function.