fixing issues where dataframe is used to write data to templates on multiple pages