Fixed cache issue for sorting.