Fixed hashtable exists function