Fix strange popup behavior