[bugfix] hash function might have returned negative number