fixed undefined dom bug