Ruby 1.8.7 p374

This adds support for ruby-1.8.7-p374 (the last release of 1.8.7). These are the same patches as for p370/p371.