File downloading but not working correctly