Fixed a bug with endnotes