modified hash function