diff --git a/changelog b/changelog
index 2d037de..665492c 100644
--- a/changelog
+++ b/changelog
@@ -1,3 +1,6 @@
+20080120 tpd src/input/Makefile add tbagg.input regression test (7102/412)
+20080120 tpd src/input/tbagg.input regression test equality in TBAGG (7102/412)
+20080120 mxr src/algebra/aggcat.spad fix equality in TBAGG (7102/412)
 20080120 tpd src/input/Makefile fix MoreSystemCommand loading (7101/204)
 20080119 gxv src/hyper/keyin handle numlock in hyperdoc correctly (7100/149)
 20080119 gxv src/hyper/dialog handle numlock in hyperdoc correctly (7100/149)
diff --git a/src/algebra/aggcat.spad.pamphlet b/src/algebra/aggcat.spad.pamphlet
index 1363c02..ae221f4 100644
--- a/src/algebra/aggcat.spad.pamphlet
+++ b/src/algebra/aggcat.spad.pamphlet
@@ -1270,7 +1270,7 @@ TableAggregate(Key:SetCategory, Entry:SetCategory): Category ==
        eq?(s,t) => true
        #s ^= #t => false
        for k in keys s repeat
-	 (e := search(k, t)) case "failed" or (e::Entry) ^= s.k => false
+	 (e := search(k, t)) case "failed" or (e::Entry) ^= s.k => return false
        true
 
      map(f: Record(key:Key,entry:Entry)->Record(key:Key,entry:Entry), t: %): % ==
diff --git a/src/input/Makefile.pamphlet b/src/input/Makefile.pamphlet
index 533002e..65741f8 100644
--- a/src/input/Makefile.pamphlet
+++ b/src/input/Makefile.pamphlet
@@ -363,7 +363,8 @@ REGRES= algaggr.regress algbrbf.regress  algfacob.regress alist.regress  \
     stbl.regress      stream2.regress  stream.regress   streams.regress \
     string.regress    strtbl.regress   summation.regress \
     symbol.regress    t111293.regress  table.regress    tancot.regress \
-    tanhcoth.regress  tanatan.regress  textfile.regress torus.regress \
+    tanhcoth.regress  tanatan.regress  tbagg.regress \
+    textfile.regress  torus.regress \
     triglim.regress   tsetcatvermeer.regress            tutchap1.regress \
     void.regress      uniseg.regress
 
@@ -638,7 +639,7 @@ FILES= ${OUT}/algaggr.input  ${OUT}/algbrbf.input    ${OUT}/algfacob.input \
        ${OUT}/symbol.input \
        ${OUT}/synonym.input  ${OUT}/t111293.input \
        ${OUT}/table.input    ${OUT}/tancot.input     ${OUT}/tanhcoth.input \
-       ${OUT}/tanatan.input  ${OUT}/test.input \
+       ${OUT}/tanatan.input  ${OUT}/tbagg.input      ${OUT}/test.input \
        ${OUT}/tetra.input    ${OUT}/textfile.input   ${OUT}/tknot.input \
        ${OUT}/tree.input \
        ${OUT}/triglim.input  ${OUT}/tschirn.input ${OUT}/tsetcatbutcher.input \
@@ -960,6 +961,7 @@ DOCFILES= \
   ${DOC}/synonym.input.dvi     ${DOC}/t111293.input.dvi    \
   ${DOC}/table.input.dvi       ${DOC}/tanatan.input.dvi    \
   ${DOC}/tancot.input.dvi      ${DOC}/tanhcoth.input.dvi   \
+  ${DOC}/tbagg.input.dvi       \
   ${DOC}/test.input.dvi        ${DOC}/tetra.input.dvi      \
   ${DOC}/textfile.input.dvi    ${DOC}/tknot.input.dvi      \
   ${DOC}/torus.input.dvi       ${DOC}/tree.input.dvi       \
diff --git a/src/input/tbagg.input.pamphlet b/src/input/tbagg.input.pamphlet
new file mode 100644
index 0000000..c33dd1f
--- /dev/null
+++ b/src/input/tbagg.input.pamphlet
@@ -0,0 +1,92 @@
+\documentclass{article}
+\usepackage{axiom}
+\begin{document}
+\title{\$SPAD/src/input tbagg.input}
+\author{Timothy Daly}
+\maketitle
+\begin{abstract}
+Equality testing was broken in TableAggregate (TBAGG)
+\end{abstract}
+\eject
+\tableofcontents
+\eject
+The equality function int TableAggregate used to read:
+\begin{verbatim}
+     s:% = t:% ==
+       eq?(s,t) => true
+       #s ^= #t => false
+       for k in keys s repeat
+	 (e := search(k, t)) case "failed" or (e::Entry) ^= s.k => false
+       true
+\end{verbatim}
+but this always returns true. Using the ``$=>$'' operator in a loop
+just causes the loop to move to the next iteration. Thus the loop
+will not take an early exit from the function and the code will always
+fall thru to the ``true'' case. This is fixed by calling the return function.
+\begin{verbatim}
+     s:% = t:% ==
+       eq?(s,t) => true
+       #s ^= #t => false
+       for k in keys s repeat
+	 (e := search(k, t)) case "failed" or (e::Entry) ^= s.k => return false
+       true
+\end{verbatim}
+<<*>>=
+)spool tbagg.output
+)set message test on
+)set message auto off
+)clear all
+ 
+--S 1 of 7
+R ==> Record(key: Symbol, entry: String)
+--R                                                                   Type: Void
+--E 1
+
+--S 2 of 7
+T ==> AssociationList(Symbol, String)
+--R                                                                   Type: Void
+--E 2
+
+--S 3 of 7
+t1:=construct([[x,"ix"]$R])$T
+--R
+--R   (3)  table(x= "ix")
+--R                                         Type: AssociationList(Symbol,String)
+--E 3
+
+--S 4 of 7
+t2:=construct([[y,"iy"]$R])$T
+--R
+--R   (4)  table(y= "iy")
+--R                                         Type: AssociationList(Symbol,String)
+--E 4
+
+--S 5 of 7
+(t1=t2)::Boolean
+--R
+--R   (5)  false
+--R                                                                Type: Boolean
+--E 5
+
+--S 6 of 7
+t3:=construct([[y,"iy"]$R])$T
+--R
+--R   (6)  table(y= "iy")
+--R                                         Type: AssociationList(Symbol,String)
+--E 6
+
+--S 7 of 7
+(t3=t2)::Boolean
+--R
+--R   (7)  true
+--R                                                                Type: Boolean
+--E 7
+)spool 
+)lisp (bye)
+ 
+@
+\eject
+\begin{thebibliography}{99}
+\bibitem{1} nothing
+\end{thebibliography}
+\end{document}
