Index: kernel/f5gb.cc
===================================================================
--- kernel/f5gb.cc	(revision 75e2e50e5ba0dbb6681ecbf8664330997a24b5e9)
+++ kernel/f5gb.cc	(revision c4158fab8010b560a681a6d3cb50c3134b84cc17)
@@ -2,5 +2,5 @@
 *  Computer Algebra System SINGULAR     *
 ****************************************/
-/* $Id: f5gb.cc,v 1.43 2009-03-12 09:43:53 ederc Exp $ */
+/* $Id: f5gb.cc,v 1.44 2009-03-12 14:34:03 ederc Exp $ */
 /*
 * ABSTRACT: f5gb interface
@@ -91,4 +91,5 @@
     criticalPair(gPrev, critPairs, lTag, rTag, rules);
     static LList* sPolyList        =   new LList();
+    //sPolyList->print();
     // labeled polynomials which have passed reduction() and have to be added to list gPrev
     static LList* completed        =   new LList();
@@ -178,5 +179,8 @@
     poly lcm            =   pOne();
     poly t              =   pHead(newElement->getPoly());
-    Rule* testedRule    =   rules->getFirst()->getRule();
+    Rule* testedRule    =   NULL;
+    if(NULL != rules->getFirst()) {
+        testedRule  =   rules->getFirst()->getRule();
+    }
     // computation of critical pairs
     //critPairs->print();
@@ -264,5 +268,5 @@
         //pWrite(ppMult_qq(t,l->getTerm()));
         //Print("%d\n\n",l->getIndex());
-        while(testNode->getIndex() < idx && NULL != testNode->getLPoly()) {
+        while(testNode->getIndex() < idx) { // && NULL != testNode->getLPoly()) {
             //pWrite(testNode->getPoly());
             //Print("%d\n",testNode->getIndex());
@@ -291,5 +295,5 @@
         RNode* tempR    =   rules->getFirst();
         int i   = 1;
-        while(NULL != tempR->getRule()) {
+        while(NULL != tempR) {
             Print("ADDRESS OF %d RNODE: %p\n",i,tempR);
             Print("ADDRESS OF RULE: %p\n",tempR->getRule());
@@ -306,9 +310,9 @@
         //pWrite(ppMult_qq(t,l->getTerm()));
         //Print("%d\n\n",l->getIndex());
-        */
+       */ 
 // start at the previously added element to gPrev, as all other elements will have the same index for sure
-    RNode* testNode =   new RNode();
+    RNode* testNode; // =   new RNode();
      
-    if(NULL == rTag->getFirst() || NULL == rTag->getFirst()->getRule()) {
+    if(NULL == rTag->getFirst() ) {
         testNode    =   rules->getFirst();
     }
@@ -343,5 +347,5 @@
     //Print("TESTNODE: %p\n",testNode);
     //pWrite(testNode->getRuleTerm());
-    if(NULL != testNode && NULL != testNode->getRule()) {   
+    if(NULL != testNode ) {   
         //pWrite(testNode->getRuleTerm());
     }
@@ -355,5 +359,5 @@
         }
     }
-    while(NULL != testNode && NULL != testNode->getRule() && testNode->getRule() != l->getRule() 
+    while(NULL != testNode && testNode->getRule() != l->getRule() 
           && l->getIndex() == testNode->getRuleIndex()) {
         //Print("%p\n",testNode);
@@ -387,11 +391,12 @@
     //Print("------------------------------IN CRITERION 2/2-----------------------------------------\n");
     //Print("LAST RULE TESTED: %p",testedRule);
-    //Print("RULES: \n");
-        //RNode* tempR    =   rules->getFirst();
-        //while(NULL != tempR->getRule()) {
-            //pWrite(tempR->getRuleTerm());
-            //Print("%d\n\n",tempR->getRuleIndex());
-            //tempR   =   tempR->getNext();
-        //}
+    /*
+    Print("RULES: \n");
+        RNode* tempR    =   rules->getFirst();
+        while(NULL != tempR) {
+            pWrite(tempR->getRuleTerm());
+            Print("%d\n\n",tempR->getRuleIndex());
+            tempR   =   tempR->getNext();
+        }
         //Print("TESTED ELEMENT: ");
         //pWrite(l->getPoly());
@@ -399,4 +404,5 @@
         //pWrite(ppMult_qq(t,l->getTerm()));
         //Print("%d\n\n",l->getIndex());
+    */
 // start at the previously added element to gPrev, as all other elements will have the same index for sure
 	RNode* testNode =   rules->getFirst();
@@ -404,5 +410,5 @@
     poly u1 = ppMult_qq(t,l->getTerm());
 	// first element added to rTag was NULL, check for this
-	while(NULL != testNode->getRule() && testNode->getRule() != testedRule) {
+	while(NULL != testNode && testNode->getRule() != testedRule) {
         //pWrite(testNode->getRuleTerm());
         if(pLmDivisibleBy(testNode->getRuleTerm(),u1)) {
@@ -506,5 +512,4 @@
                         sPolyList->insertByLabel(ppMult_qq(temp->getT1(),temp->getLp1Term()),temp->getLp1Index(),sp,rules->getFirst()->getRule());
                     }
-                    // data is saved in sPolyList or zero => delete sp
                 }
             }
@@ -554,5 +559,5 @@
         // delete the above first element from sPolyList, temp will be either reduced to
         // zero or added to gPrev, but never come back to sPolyList
-        if(NULL != temp && NULL != temp->getLPoly()) {
+        if(NULL != temp) { 
             sPolyList->setFirst(temp->getNext());
         //Print("HIER\n");
@@ -831,5 +836,5 @@
     // this must be done due to possible later improvements
     RList* rules    =   new RList();
-    //Print("RULES FIRST: %p\n",rules->getFirst());
+    Print("RULES FIRST: %p\n",rules->getFirst());
     //Print("RULES FIRST DATA: %p\n",rules->getFirst()->getRule());
     RTagList* rTag  =   new RTagList(rules->getFirst());
@@ -965,5 +970,5 @@
         //Print("JA\n");
     } 
-        idShow(gbPrev);
+        //idShow(gbPrev);
     Print("\n\nNumber of zero-reductions:  %d\n",reductionsToZero);
     //LNode* temp    =   gPrev->getFirst();
Index: kernel/f5lists.cc
===================================================================
--- kernel/f5lists.cc	(revision 75e2e50e5ba0dbb6681ecbf8664330997a24b5e9)
+++ kernel/f5lists.cc	(revision c4158fab8010b560a681a6d3cb50c3134b84cc17)
@@ -111,5 +111,5 @@
     //Print("new element: ");
     //pWrite(t);
-       if(NULL == this || NULL == data) {
+       if(NULL == this) { // || NULL == data) {
         LNode* newElement   =   new LNode(t, i, p, r, this);
         return newElement;
@@ -242,6 +242,5 @@
 
 LList::LList() {
-    first   =   new LNode();
-    last    =   first;
+    first   =   last    =   NULL;;
     length  =   0;
 }
@@ -931,5 +930,5 @@
 RTagList::~RTagList() {
     RTagNode* temp;
-    while(first->getRNode()) {
+    while(first) {
         temp    =   first;
         first   =   first->getNext();
