Fix sorting while updating condition