fail-safe for jruby problems with IO.copy_stream