backport from ruby/ruby
Merge pull request #2 from hsbt/backport-from-ruby-trunk

Backport from ruby/ruby