calculate correct line numbers