when under the version of ruby 2.1.0, array doesn't support the method to_h
So change to_h with Hash[[[2,1],[1,2]]].