fix for memory leak when DOM object not emptied