Fixed more incorrect dom handling and problems