Fix sorting + validations