fixing an issue in removeFromDOM()