--- loncom/homework/bridgetask.pm	2006/10/11 18:54:33	1.183
+++ loncom/homework/bridgetask.pm	2006/10/11 21:06:49	1.184
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA 
 # definition of tags that give a structure to a document
 #
-# $Id: bridgetask.pm,v 1.183 2006/10/11 18:54:33 albertel Exp $
+# $Id: bridgetask.pm,v 1.184 2006/10/11 21:06:49 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1102,8 +1102,6 @@ DONEBUTTON
 	    if ($award eq 'SUBMITTED') {
 		&add_to_queue('gradingqueue',\%queue_data);
 	    }
-	} elsif ($Apache::lonhomework::results{'INTERNAL_store'}) {
-	    &Apache::structuretags::finalize_storage();
 	}
 	if ($target eq 'grade' && $env{'form.webgrade'} eq 'yes' 
 	    && exists($env{'form.cancel'})) {
@@ -1214,6 +1212,10 @@ DONEBUTTON
 	    &minimize_storage();
 	    &Apache::structuretags::finalize_storage();
 	}
+	if (exists($Apache::lonhomework::results{'INTERNAL_store'})) {
+	    # instance generation occured and hasn't yet been stored
+	    &Apache::structuretags::finalize_storage();
+	}
     } elsif ($target eq 'webgrade') {
 	$result.="</div>";
 	#$result.='<input type="submit" name="next" value="'.