fixed bug in downloading files