Fix dom elements removing issue