remove obsolete global vars
fix the bug that closed popups unexpectedly