Make code work on Ruby 1.9