Corrected linepos assignment