fixed hash util function