added a check to verify that the page zero TG metadata are stored into the correct document