Add try block to handle overlapping tags