updated for version 7.0021
diff --git a/src/syntax.c b/src/syntax.c
index 4956aec..0c706c8 100644
--- a/src/syntax.c
+++ b/src/syntax.c
@@ -2339,6 +2339,10 @@
 		cur_si->si_h_endpos = cur_si->si_eoe_pos;
 		cur_si->si_flags |= HL_MATCH;
 		update_si_attr(current_state.ga_len - 1);
+
+		/* what matches next may be different now, clear it */
+		next_match_idx = 0;
+		next_match_col = MAXCOL;
 		break;
 	    }
 	    else
@@ -2439,6 +2443,8 @@
 	{
 	    sip->si_attr = CUR_STATE(idx - 1).si_attr;
 	    sip->si_trans_id = CUR_STATE(idx - 1).si_trans_id;
+	    sip->si_h_startpos = CUR_STATE(idx - 1).si_h_startpos;
+	    sip->si_h_endpos = CUR_STATE(idx - 1).si_h_endpos;
 	    if (sip->si_cont_list == NULL)
 	    {
 		sip->si_flags |= HL_TRANS_CONT;
@@ -5620,7 +5626,8 @@
     int		r;
 
     /* If spp has a "containedin" list and "cur_si" is in it, return TRUE. */
-    if (cur_si != NULL && ssp->cont_in_list != NULL)
+    if (cur_si != NULL && ssp->cont_in_list != NULL
+					    && !(cur_si->si_flags & HL_MATCH))
     {
 	/* Ignore transparent items without a contains argument.  Double check
 	 * that we don't go back past the first one. */