Fix for to_hash when the input is given in strings (thats the case when using json)