Fixed bug in monoid simplification (did not properly recurse).