fixed function to iterate through hash table and remove hash entries