Change implementation so JRuby can work as expected.