Take hash recalculation into do_lookup()