fix bad assumption about total lines