Sort by keys using underscore correctly