Use a unique tuple rather than a hash as the dictionary key -- hash collisions are unfortunately all too common.