make sure dir() of locals returns a sorted list