Fixes a logic error if there isn't a header div in any of the documents, now checks for a header div