Made download work correctly