fix removal of unneeded tags