do not clear the hash function bit
Added more bit manipulation and fixed hash param check