Fix use of with_index for older ruby version