fixed bug with changing hash while iterating over it