diff --git a/src/fr-archive-libarchive.c b/src/fr-archive-libarchive.c
index 9a11e45..2f8d944 100644
--- a/src/fr-archive-libarchive.c
+++ b/src/fr-archive-libarchive.c
@@ -561,6 +561,7 @@ extract_archive_thread (GSimpleAsyncResult *result,
 	GHashTable           *created_folders;
 	GHashTable           *folders_created_during_extraction;
 	struct archive       *a;
+	struct archive       *ext;
 	struct archive_entry *entry;
 	int                   r;
 
@@ -777,12 +778,16 @@ extract_archive_thread (GSimpleAsyncResult *result,
 				break;
 
 			case AE_IFREG:
-				ostream = (GOutputStream *) g_file_replace (file, NULL, FALSE, G_FILE_CREATE_REPLACE_DESTINATION, cancellable, &load_data->error);
-				if (ostream == NULL)
+				ext = archive_write_disk_new();
+				if (ext == NULL)
 					break;
+				archive_write_disk_set_options(ext, ARCHIVE_EXTRACT_TIME|ARCHIVE_EXTRACT_PERM|ARCHIVE_EXTRACT_ACL|ARCHIVE_EXTRACT_FFLAGS);
+				archive_write_disk_set_standard_lookup(ext);
+				archive_entry_set_pathname(entry, g_file_get_path(file));
+				archive_write_header(ext, entry);
 
 				while ((r = archive_read_data_block (a, &buffer, &buffer_size, &offset)) == ARCHIVE_OK) {
-					if (g_output_stream_write (ostream, buffer, buffer_size, cancellable, &load_data->error) == -1)
+					if ((r = archive_write_data_block(ext, buffer, buffer_size, offset)) < ARCHIVE_OK)
 						break;
 					fr_archive_progress_inc_completed_bytes (load_data->archive, buffer_size);
 				}
@@ -791,7 +796,7 @@ extract_archive_thread (GSimpleAsyncResult *result,
 				if (r != ARCHIVE_EOF)
 					load_data->error = _g_error_new_from_archive_error (archive_error_string (a));
 				else
-					_g_file_set_attributes_from_entry (file, entry, extract_data, cancellable, NULL);
+					archive_write_finish_entry(ext);
 				break;
 
 			case AE_IFLNK:
@@ -835,6 +840,8 @@ extract_archive_thread (GSimpleAsyncResult *result,
 	g_hash_table_unref (created_folders);
 	g_hash_table_unref (checked_folders);
 	archive_read_free (a);
+	archive_write_close(ext);
+	archive_write_free (ext);
 	extract_data_free (extract_data);
 }
 
