Fixed popups showing and hiding in strange ways.