Fix bug with lastLine and sampleStartLine