Fix many bugs related to use of hash tables.