Fix get_needed_hooks