Fix needs_rehash() cost comparison