compute line number in the most inelegant way imaginable