Fixed bugs for transferring files