diff --git a/lib/xdr.rb b/lib/xdr.rb
index <HASH>..<HASH> 100644
--- a/lib/xdr.rb
+++ b/lib/xdr.rb
@@ -10,7 +10,7 @@ require "active_support/core_ext/hash/indifferent_access"
 require "active_support/core_ext/string/inflections"
 require "active_support/logger"
 require "active_support/ordered_hash"
-require "backports/2.0.0/hash/to_h"
+require "backports/2.1.0/array/to_h"
 
 module XDR
   extend ActiveSupport::Autoload
diff --git a/lib/xdr/concerns/converts_to_xdr.rb b/lib/xdr/concerns/converts_to_xdr.rb
index <HASH>..<HASH> 100644
--- a/lib/xdr/concerns/converts_to_xdr.rb
+++ b/lib/xdr/concerns/converts_to_xdr.rb
@@ -5,7 +5,7 @@ module XDR::Concerns::ConvertsToXDR
     StringIO.
       new.
       tap{|io| write(val, io)}.
-      string.b
+      string.force_encoding("ASCII-8BIT")
   end
 
   def write(val, io)
Fix backport issues (should bring back compatibility)

We want Array#to_h, not Hash#to_h
Use String#force_encoding instead of String#b