My stab at fixing JRUBY-7122
Merge pull request #674 from trejkaz/master

My stab at fixing JRUBY-7122