Updated statistics and fixed bug in hash_next_foreach