Fixed bug when half uploading a file