Fixes issue #40 for jruby too.