Assigning footnotes to the correct page