more tweaks on popup hiding