fixed bug that occurs occasionally when downloading files