Fixed bugs related to adding metadata to an index file