modified linearselect.py