Fix paging on jruby [Fixes #992]