preserve selection while sorting