Fix behavior on JRuby