Added a check for popups