Fixed some errors in line counting