Fix bug with sort and add an callback when sort is changed by user