fixing the popup generation