fixed bugs on "twice" to display the window