fixing pop-up behavior