bug fix for label sorting.