Fix incorrect dom handling