Fix class removal on elements