Fixed filtering and sorting issues