ruby 1.8 hash.keys are not ordered, they need sort
Merge pull request #872 from patrickatamaniuk/releases/ruby187

ruby 1.8 hash.keys are not ordered, they need sort