fixed metadata overwrite bug