fixed logik to work with sort inference from cells