Fixed error when can't find the dom