Fix infinite loop regression in unfold_hotkeys