added safety to html deletion