Fix bug where we download inside a db transaction