Fix to_h only available in ruby 2.1+