index refers to wrong page when indexing words outside of the mainmatter

This also happens in the bookdown package demo book. On this line is an index entry in front matter ( index.Rmd ) for GitBook: https://github.com/rstudio/bookdown/blob/6ae8900f1438a463a6e14ab8ffbe75eecb1d59a4/inst/examples/index.Rmd#L54

And then in the pdf, if you look in the index for GitBook it refers to page ix, which again is a page in the list of figures.