Realize popup and some bugs fixed