diff --git a/metis_l2_prep_uv.pro b/metis_l2_prep_uv.pro
index de9a0d4f33461df1d63b0f17d2405eb74b6a01a9..0b4c2a3f04ee8d819c59c568d867f93d7424a4ef 100644
--- a/metis_l2_prep_uv.pro
+++ b/metis_l2_prep_uv.pro
@@ -50,6 +50,10 @@ pro metis_l2_prep_uv
 	journal, '  sess_num = ' + header.sess_num
 	journal, '  nbin = ' + string(sqrt(header.nbin), format = '(I0)')
 
+	; error is the quadratic relative error
+	
+	error = 0.
+
 	; calibration block
 
 	case header.datatype of
@@ -63,7 +67,7 @@ pro metis_l2_prep_uv
 		; header.nsumexp = header.ndit1 * header.ndit2
 		; ====================================
 
-		data = metis_dark_uvda(data, header, cal_pack, history = history)
+		data = metis_dark_uvda(data, header, cal_pack, error = error, quality_matrix = quality_matrix, history = history)
 
 		; ====================================
 		; for data already subtracted of dark
@@ -74,15 +78,13 @@ pro metis_l2_prep_uv
 		; history = ['Dark correction: ', '  ' + file]
 		; ====================================
 
-		data = metis_flat_field(data, header, cal_pack, history = history)
-		data = metis_vignetting(data, header, cal_pack, history = history)
-		data = metis_rad_cal(data, header, cal_pack, history = history)
+		data = metis_flat_field(data, header, cal_pack, error = error, quality_matrix = quality_matrix, history = history)
+		data = metis_vignetting(data, header, cal_pack, error = error, quality_matrix = quality_matrix, history = history)
+		data = metis_rad_cal(data, header, cal_pack, error = error, quality_matrix = quality_matrix, history = history)
 
 		; ====================================
 		; for simple radiometric calibration
-		; data = data/header.xposure
 		; cal_pack.uv_channel.cal_units = 'DN/s'
-		; history = [history, 'Radiometric calibration: ', '  exposure normalisation only']
 		; ====================================
 
 		; ====================================
@@ -135,7 +137,7 @@ pro metis_l2_prep_uv
 
 	fxaddpar, primary_header, 'FILENAME', file_name
 	fxaddpar, primary_header, 'PARENT', file_basename(input.file_name)
-	fxaddpar, primary_header, 'LEVEL', 'L2-draft'
+	fxaddpar, primary_header, 'LEVEL', 'L2'
 	fxaddpar, primary_header, 'ORIGIN', ''
 	fxaddpar, primary_header, 'CREATOR', 'metis_l2_prep_uv.pro'
 	fxaddpar, primary_header, 'VERS_SW', input.sw_version
@@ -148,6 +150,8 @@ pro metis_l2_prep_uv
 	fxaddpar, primary_header, 'XPOSURE', header.xposure
 	fxaddpar, primary_header, 'NSUMEXP', header.nsumexp
 
+	sxdelpar, primary_header, 'BLANK'
+	
 	; append wcs keywords
 
 	wcs = metis_wcs(header, cal_pack, ref_detector = ref_detector)
@@ -160,10 +164,6 @@ pro metis_l2_prep_uv
 
 	history = [history, 'Update WCS and solar ephemeris:', '  SKD version = ' + kernel_version]
 
-	; delete useless keywords
-
-	sxdelpar, primary_header, 'BLANK'
-
 	; add the history keyword
 
 	for k = 0, n_elements(history) - 1 do $
@@ -201,7 +201,7 @@ pro metis_l2_prep_uv
 	fxaddpar, extension_header, 'PCOUNT', 0, 'Parameter count'
 	fxaddpar, extension_header, 'GCOUNT', 1, 'Group count'
 	fxaddpar, extension_header, 'EXTNAME', 'Error matrix', 'Extension name'
-	error_matrix = intarr(header.naxis1, header.naxis2)
+	error_matrix = data * sqrt(error)
 	if not ref_detector then error_matrix = metis_rectify(error_matrix, 'UV')
 	fits_add_checksum, extension_header, error_matrix
 	mwrfits, error_matrix, out_file_name, extension_header, /no_comment, /silent