Fix build issues on mri 1.8.7 and jruby