popup handling fixes