Fix the issue with d_line calculation