fix bugs in popup