Filtering and sorting bugfixed