Some improvement to file uploading