Fix Hash type casting

As merged in #3288