  	bundlefile = g_file_new_for_path(bundlename);
  	bundlestream = g_file_append_to(bundlefile, G_FILE_CREATE_NONE, NULL, &ierror);
  	if (bundlestream == NULL) {
-@@ -361,17 +348,40 @@ static gboolean sign_bundle(const gchar *bundlename, GError **error)
+@@ -407,17 +394,40 @@ static gboolean sign_bundle(const gchar *bundlename, GError **error)
  		return FALSE;
  	}
- 
+
 +	/* get current file size */
  	offset = g_seekable_tell((GSeekable *)bundlestream);
 -	if (!output_stream_write_bytes_all((GOutputStream *)bundlestream, sig, NULL, &ierror)) {

+					"failed signing bundle: ");
+			return FALSE;
+		}
 
+		if (!output_stream_write_bytes_all((GOutputStream *)bundlestream, sig, NULL, &ierror)) {
+			g_propagate_prefixed_error(
+					error,

-
 	if (verify) {
+		res = input_stream_read_bytes_all(G_INPUT_STREAM(bundlestream),
+				&ibundle->sigdata, sigsize, NULL, &ierror);
+		if (!res) {
+			g_propagate_prefixed_error(
+					error,
