Fixing the metadata creation for structured documents and other minor bug fixes.