added code to repair mangled tags