fix popup window bugs