fix write failure in source_metadata