fixed popup class logic