Rubygems fix

for [Bug #7698] and [Bug #7971].