--- loncom/lonnet/perl/lonnet.pm	2003/11/10 21:50:21	1.444
+++ loncom/lonnet/perl/lonnet.pm	2003/11/10 23:57:49	1.446
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # TCP networking package
 #
-# $Id: lonnet.pm,v 1.444 2003/11/10 21:50:21 www Exp $
+# $Id: lonnet.pm,v 1.446 2003/11/10 23:57:49 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -247,10 +247,10 @@ sub transfer_profile_to_env {
             }
         }
     }
+    $ENV{'user.environment'} = "$lonidsdir/$handle.id";
     foreach my $expired_key (keys(%Remove)) {
         &delenv($expired_key);
     }
-    $ENV{'user.environment'} = "$lonidsdir/$handle.id";
 }
 
 # ---------------------------------------------------------- Append Environment
@@ -895,7 +895,7 @@ EVALBLOCK
 	}
     } else {
 	if (-e $filename) {
-	    &logthis("Unable to tie hash (save cache item): $name");
+	    &logthis("Unable to tie hash (save cache item): $name ($!)");
 	    unlink($filename);
 	}
     }
@@ -939,7 +939,7 @@ EVALBLOCK
 	}        
     } else {
 	if (-e $filename) {
-	    &logthis("Unable to tie hash (load cache item): $name");
+	    &logthis("Unable to tie hash (load cache item): $name ($!)");
 	    unlink($filename);
 	}
     }