better _popup_modal_wrap check