Fix sorting and filtering