--- Bugzilla.pm	2010-03-08 17:45:42.000000000 +0200
+++ Bugzilla.pm.new	2010-03-20 14:46:55.000000000 +0200
@@ -567,9 +567,9 @@
         # Since Bugzilla 3.1.3 AppendComment has been replaced by add_comment
 	my $userid = Bugzilla::User::login_to_id( $username );
 	if ( $userid > 0 ) {
-            my $bug = Bugzilla::Bug->check($bugid);
             my $user = new Bugzilla::User($userid);
             Bugzilla->set_user($user);
+            my $bug = Bugzilla::Bug->check($bugid);
             $bug->add_comment($comment, {isprivate => 0, work_time => 0, type => Bugzilla::Constants->CMT_NORMAL, extra_data => ""} );
             $bug->update();
 	    return 0;
