Fix popup window bug