fix needs to work both for local files and downloads