I modified like this:

```ruby
  def rename_taps_dir_if_necessary
    need_repair_taps = false
    Dir["#{HOMEBREW_LIBRARY}/Taps/*/"].each do |tapd|
      tapd_basename = File.basename(tapd)

      if File.directory?(tapd + "/.git") && tapd_basename.include?("-")
        # only replace the *last* dash: yes, tap filenames suck
        user, repo = tapd_basename.reverse.sub("-", "/").reverse.split("/")

        FileUtils.mkdir_p("#{HOMEBREW_LIBRARY}/Taps/#{user.downcase}")
        FileUtils.mv(tapd, "#{HOMEBREW_LIBRARY}/Taps/#{user.downcase}/#{repo.downcase}")
        need_repair_taps = true

        if tapd_basename.count("-") >= 2
          opoo "You may manually fix #{HOMEBREW_LIBRARY}/Taps/#{user.downcase}/#{repo.downcase}."
        end
      end
    end

    repair_taps if need_repair_taps
  end
```