- fixed the popover hiding logic