Fixing leaks when sorting and using multi value.