fix some resource conflict bugs with updating media
Merge pull request #2484 from dimagi/mediaaaa

fix some resource conflict bugs with updating media