Ruby187 compat

@yuanying, I've tested the patchset does not break 1.9 compat running rake spec.