Calculate line length correctly