fix for wacky document parsing under jruby