Make string indexing work for Ruby 1.8 and 1.9