bug fix
diff --git a/R/collapse_rows.R b/R/collapse_rows.R
index d9a305c..bf0e036 100644
--- a/R/collapse_rows.R
+++ b/R/collapse_rows.R
@@ -45,6 +45,7 @@
 
   for (i in 1:nrow(collapse_matrix)) {
     matrix_row <- collapse_matrix[i, ]
+    names(matrix_row) <- names(collapse_matrix)
     target_row <- xml_child(kable_tbody, i)
     row_node_rm_count <- 0
     for (j in 1:length(matrix_row)) {
diff --git a/tests/visual_tests/collapse_rows_html.Rmd b/tests/visual_tests/collapse_rows_html.Rmd
index 9ca589e..3f50879 100644
--- a/tests/visual_tests/collapse_rows_html.Rmd
+++ b/tests/visual_tests/collapse_rows_html.Rmd
@@ -14,5 +14,5 @@
 kable(collapse_rows_dt, "html", align = "c") %>%
   kable_styling() %>%
   column_spec(1, bold=T) %>%
-  collapse_rows(1:2)
+  collapse_rows()
 ```
diff --git a/tests/visual_tests/collapse_rows_pdf.Rmd b/tests/visual_tests/collapse_rows_pdf.Rmd
index 795bbe1..a2f1138 100644
--- a/tests/visual_tests/collapse_rows_pdf.Rmd
+++ b/tests/visual_tests/collapse_rows_pdf.Rmd
@@ -13,5 +13,5 @@
 kable(collapse_rows_dt, "latex", align = "c", booktabs = T) %>%
   kable_styling() %>%
   column_spec(1, bold=T, width = "2em") %>%
-  collapse_rows(1:2)
+  collapse_rows(1)
 ```