Fix the problem with invalid ranges of multi-line element selection

-- Make selection correction os dependant