Index: trunk/PS-IPP-PStamp/lib/PS/IPP/PStamp/Job.pm
===================================================================
--- trunk/PS-IPP-PStamp/lib/PS/IPP/PStamp/Job.pm	(revision 24831)
+++ trunk/PS-IPP-PStamp/lib/PS/IPP/PStamp/Job.pm	(revision 24921)
@@ -24,4 +24,5 @@
 use PS::IPP::Metadata::List qw( parse_md_list );
 use PS::IPP::Config qw( :standard );
+use Carp;
 
 ### my @images = locate_images($image_db, $req_type, $img_type, $id, $component,
@@ -121,4 +122,5 @@
     my $command;
     my $id_opt;     # option for the lookup
+    my $image_name;
     my $mask_name;
     my $weight_name;
@@ -130,5 +132,5 @@
 
     # special class_id value "null" means ignore
-    if ($component eq "null") {
+    if ($component and ($component eq "null")) {
         $component = undef;
     }
@@ -146,4 +148,5 @@
         $command .= " -class_id $class_id" if $class_id;
         $id_opt = "-chip_id";
+        $image_name   = "PPIMAGE.CHIP";
         $mask_name    = "PPIMAGE.CHIP.MASK";
         $weight_name  = "PPIMAGE.CHIP.VARIANCE";
@@ -156,4 +159,5 @@
         $command .= " -skycell_id $skycell_id" if $skycell_id;
         $id_opt = "-warp_id";
+        $image_name   = "PSWARP.OUTPUT";
         $mask_name    = "PSWARP.OUTPUT.MASK";
         $weight_name  = "PSWARP.OUTPUT.VARIANCE";
@@ -164,4 +168,5 @@
         $command .= " -skycell_id $skycell_id" if $skycell_id;
         $id_opt = "-diff_id";
+        $image_name  = "PPSUB.OUTPUT";
         $mask_name   = "PPSUB.OUTPUT.MASK";
         $weight_name = "PPSUB.OUTPUT.VARIANCE";
@@ -171,4 +176,5 @@
         $id_opt = "-stack_id";
 
+        $image_name  = "PPSTACK.OUTPUT";
         $mask_name   = "PPSTACK.OUTPUT.MASK";
         $weight_name = "PPSTACK.OUTPUT.VARIANCE";
@@ -225,20 +231,22 @@
             $ipprc->define_camera($camera);
         }
-        my $out = {};
-        $out->{exp_id} = $image->{exp_id};
-        $out->{exp_name} = $image->{exp_name};
+        my $out = $image;
+        # if uri is nil this will get overridded below
         $out->{image}  = $image->{uri};
-        $out->{state}  = $image->{state}; # state is undef for rawExp, but that's ok
-        if ($set_class_id) {
-            $class_id = $image->{class_id};
-            $out->{class_id} = $class_id;
-        }
+#        $out->{exp_id} = $image->{exp_id};
+#        $out->{exp_name} = $image->{exp_name};
+#        $out->{state}  = $image->{state}; # state is undef for rawExp, but that's ok
+#        if ($set_class_id) {
+#            $class_id = $image->{class_id};
+#            $out->{class_id} = $class_id;
+#        }
 
         # find the mask and weight images
         if ($base) {
+            $out->{image}  = $ipprc->filename($image_name,   $base, $class_id) if $image_name;
             $out->{mask}   = $ipprc->filename($mask_name,   $base, $class_id) if $mask_name;
             $out->{weight} = $ipprc->filename($weight_name, $base, $class_id) if $weight_name;
         }
-        $out->{camera} = $camera;
+#        $out->{camera} = $camera;
 
         $out->{astrom} = find_astrometry($ipprc, $image_db, $image, $verbose) if $want_astrom;
@@ -539,10 +547,20 @@
 # resolve_project()
 # get project specific information
+my $last_project = "";
 sub resolve_project {
     my $ipprc = shift;
     my $project_name = shift;
+
+    if (!$project_name) {
+        carp ("project is not defined");
+        return undef;
+    }
+
+    if ($project_name eq $last_project) {
+        return $last_project;
+    }
+
     my $dbname = shift;
     my $dbserver = shift;
-    die "project is not defined" if !$project_name;
 
     my $verbose = 0;
@@ -575,5 +593,7 @@
     my $proj_hash = parse_md_fast($mdcParser, $output);
 
-    return $proj_hash->[0];
+    $last_project = $proj_hash->[0];
+
+    return $last_project;
 }
 1;
Index: trunk/PS-IPP-PStamp/lib/PS/IPP/PStamp/RequestFile.pm
===================================================================
--- trunk/PS-IPP-PStamp/lib/PS/IPP/PStamp/RequestFile.pm	(revision 24831)
+++ trunk/PS-IPP-PStamp/lib/PS/IPP/PStamp/RequestFile.pm	(revision 24921)
@@ -26,4 +26,5 @@
 
 
+# these values need to match the ones in pstamp/src/pstamp.h
 our $PSTAMP_CENTER_IN_PIXELS = 1;
 our $PSTAMP_RANGE_IN_PIXELS  = 2;
