fix bugs in popup windows