added lines to write the dataset metadata