Fix the order of reserve and rehash.