fixed the issue of the popups overflow and not closing properly