better hash function, fixed updates