Invoke HashWithIndifferentAccess#to_hash to cast to a hash since #to_h is not defined on Ruby19 and lower