Sort in Ruby
Restore secondary sort order that was lost in 43c7b9e