[bugfix] Fetch tag ID before calling undefineTag()