Use IndexError for ruby 1.8

Which does not have KeyError.