avoid "warning: Hash#index is deprecated; use Hash#key" with ruby 1.9