Fix DOM extraction bug