fixing download functionality