fix reading number of lines