fixed some bugs, added popup window