Index: trunk/ippScripts/scripts/detrend_apply_norm.pl
===================================================================
--- trunk/ippScripts/scripts/detrend_apply_norm.pl	(revision 8850)
+++ trunk/ippScripts/scripts/detrend_apply_norm.pl	(revision 8853)
@@ -28,4 +28,6 @@
 my $mdcParser = PS::IPP::Metadata::Config->new; # Parser for metadata config files
 
+my $outName = $output . '.' . $classId . '.fit'; # Output file name
+
 # Run ppArith
 my $norms;
@@ -34,12 +36,13 @@
     my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
 	run(command => $command, verbose => 1);
-    die "Unable to perform ppArith: $error_code\n"
-	if not $success;
+    die "Unable to perform ppArith: $error_code\n" if not $success;
+    die "Can't find expected output file: $outName\n" if not -e $outName;
 }
+
 
 # Update the database
 {
-    my $command = "$dettool -addnormalizedimfile -det_id $detId -iter $iter -class_id $classId ".
-	"-uri $output"; # Command to run
+    my $command = "$dettool -addnormalizedimfile -det_id $detId -iteration $iter -class_id $classId ".
+	"-uri $outName"; # Command to run
     my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
 	run(command => $command, verbose => 1);
