Fixes sorting of the results of expand based on newer key value structure.